Skip to content

Commit

Permalink
Add special fields in the index pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
monicasarbu committed Jan 4, 2017
1 parent 5b973a0 commit a846869
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ https://github.com/elastic/beats/compare/v5.1.1...master[Check the HEAD diff]

*Affecting all Beats*

- Add `_id`, `_type`, `_index` and `_score` fields in the generated index pattern. {pull}3282}[3282]

*Metricbeat*

- Fix service times-out at startup. {pull}3056[3056]
Expand Down
13 changes: 13 additions & 0 deletions libbeat/scripts/generate_index_pattern.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

unique_fields = []


def fields_to_json(section, path, output):

for field in section["fields"]:
Expand Down Expand Up @@ -92,6 +93,18 @@ def fields_to_index_pattern(args, input):
for k, section in enumerate(docs["fields"]):
fields_to_json(section, "", output)

# add special fields
special_fields = {
"fields": [
{"name": "_index", "type": "text"},
{"name": "_id", "type": "text"},
{"name": "_type", "type": "text"},
{"name": "_score", "type": "integer"}
],
}

fields_to_json(special_fields, "", output)

output["fields"] = json.dumps(output["fields"])
output["fieldFormatMap"] = json.dumps(output["fieldFormatMap"])
return output
Expand Down

0 comments on commit a846869

Please sign in to comment.