Skip to content

Commit 07165e7

Browse files
authored
Merge pull request #116 from ViaQ/viaq_index_name
Introduce viaq_index_name field
2 parents 2f4198d + 82ae6c1 commit 07165e7

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

namespaces/_default_.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,10 @@ _index_type_:
187187
store or application other than Elasticsearch, but you still need
188188
to correlate data with the data stored in Elasticsearch, this field
189189
will give you the exact document corresponding to the record.
190+
191+
- name: viaq_index_name
192+
type: keyword
193+
example: project.my-cool-project-in-lab04.748e92c2-70d7-11e9-b387-000d3af2d83b.2019.05.09
194+
description: |
195+
Index name in which this message will be stored within the Elasticsearch.
196+
The value of this field is generated based on the source of the message.

scripts/compare_against_released_patterns_test.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ def _support_index_pattern_fields_field_only(self, released_file_URL, es_version
151151
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.LINE_BREAK"]
152152
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.STREAM_ID"]
153153
generated_fields = [item for item in generated_fields if not item["name"] == "systemd.t.SYSTEMD_INVOCATION_ID"]
154-
# ======================
154+
155+
# https://github.com/ViaQ/elasticsearch-templates/pull/115
156+
generated_fields = [item for item in generated_fields if not item["name"] == "viaq_index_name"]
157+
# ======================
155158

156159
# ---- wget
157160
print('\nDownloading released index pattern file for comparison:')

scripts/compare_against_released_templates_test.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,14 @@ def _remove_all_field(data, es_version):
8686
_idx_type = supported.index_type_name(es_version)
8787
if "_all" in data["mappings"][_idx_type]:
8888
del data["mappings"][_idx_type]["_all"]
89-
89+
90+
@staticmethod
91+
def _remove_viaq_index_name_field(generated_json, es_version):
92+
# Remove 'viaq_index_name' field. It was introduced after support for ES6.x was added.
93+
# https://github.com/ViaQ/elasticsearch-templates/pull/115
94+
_idx_type = supported.index_type_name(es_version)
95+
if "viaq_index_name" in generated_json["mappings"][_idx_type]["properties"]:
96+
del generated_json["mappings"][_idx_type]["properties"]["viaq_index_name"]
9097

9198
@staticmethod
9299
def _generate_json_index_template(args, es_version):
@@ -156,11 +163,14 @@ def _support_compare_index_templates(self, es_version, args, json_url):
156163
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["STREAM_ID"]
157164
del generated_json["mappings"][_idx_type]["properties"]["systemd"]["properties"]["t"]["properties"]["SYSTEMD_INVOCATION_ID"]
158165

166+
self._remove_viaq_index_name_field(generated_json, es_version)
167+
159168
elif es_version == supported._es5x:
160-
pass
169+
self._remove_viaq_index_name_field(generated_json, es_version)
161170

162171
elif es_version == supported._es6x:
163172
self._remove_all_field(generated_json, es_version)
173+
self._remove_viaq_index_name_field(generated_json, es_version)
164174
# ======================
165175

166176
generated_index_template = self._sort(generated_json)

0 commit comments

Comments
 (0)