Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce viaq_index_name field #116

Merged
merged 2 commits into from
Nov 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions namespaces/_default_.yml
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,10 @@ _index_type_:
store or application other than Elasticsearch, but you still need
to correlate data with the data stored in Elasticsearch, this field
will give you the exact document corresponding to the record.

- name: viaq_index_name
type: keyword
example: project.my-cool-project-in-lab04.748e92c2-70d7-11e9-b387-000d3af2d83b.2019.05.09
description: |
Index name in which this message will be stored within the Elasticsearch.
Copy link
Member Author

@lukas-vlcek lukas-vlcek Dec 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@richm @jcantrill How is this going to be impacted when moving to the new data model with ES 6.x (rollover and common index; no more index per namespace/day).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still need this field

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The value of this field is generated based on the source of the message.
5 changes: 4 additions & 1 deletion scripts/compare_against_released_patterns_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def _support_index_pattern_fields_field_only(self, released_file_URL, es_version
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.LINE_BREAK"]
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.STREAM_ID"]
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.SYSTEMD_INVOCATION_ID"]
# ======================

# https://github.com/ViaQ/elasticsearch-templates/pull/115
generated_fields = [item for item in generated_fields if not item["name"] == "viaq_index_name"]
# ======================

# ---- wget
print('\nDownloading released index pattern file for comparison:')
Expand Down
14 changes: 12 additions & 2 deletions scripts/compare_against_released_templates_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ def _remove_all_field(data, es_version):
_idx_type = supported.index_type_name(es_version)
if "_all" in data["mappings"][_idx_type]:
del data["mappings"][_idx_type]["_all"]


@staticmethod
def _remove_viaq_index_name_field(generated_json, es_version):
# Remove 'viaq_index_name' field. It was introduced after support for ES6.x was added.
# https://github.com/ViaQ/elasticsearch-templates/pull/115
_idx_type = supported.index_type_name(es_version)
if "viaq_index_name" in generated_json["mappings"][_idx_type]["properties"]:
del generated_json["mappings"][_idx_type]["properties"]["viaq_index_name"]

@staticmethod
def _generate_json_index_template(args, es_version):
Expand Down Expand Up @@ -156,11 +163,14 @@ def _support_compare_index_templates(self, es_version, args, json_url):
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["STREAM_ID"]
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["SYSTEMD_INVOCATION_ID"]

self._remove_viaq_index_name_field(generated_json, es_version)

elif es_version == supported._es5x:
pass
self._remove_viaq_index_name_field(generated_json, es_version)

elif es_version == supported._es6x:
self._remove_all_field(generated_json, es_version)
self._remove_viaq_index_name_field(generated_json, es_version)
# ======================

generated_index_template = self._sort(generated_json)
Expand Down