-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more integ test for update mapping and fetch derived fields
Signed-off-by: Rishabh Maurya <rishabhmaurya05@gmail.com>
- Loading branch information
1 parent
1dd9df6
commit 07fed11
Showing
4 changed files
with
796 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
123 changes: 123 additions & 0 deletions
123
...pec/src/main/resources/rest-api-spec/test/derived_fields/20_derived_field_put_mapping.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
--- | ||
"Test create and update mapping for derived fields": | ||
- skip: | ||
version: " - 2.14.99" | ||
reason: "derived_field feature was added in 2.15" | ||
- do: | ||
indices.create: | ||
index: test_index | ||
|
||
- do: | ||
indices.put_mapping: | ||
index: test_index | ||
body: | ||
properties: | ||
text: | ||
type: text | ||
json_field: | ||
type: text | ||
derived: | ||
derived_text: | ||
type: text | ||
script: "emit(params._source[\"text\"])" | ||
derived_text_source_indexed_field: | ||
type: keyword | ||
script: "emit(params._source[\"text\"])" | ||
source_indexed_field: "text" | ||
derived_date: | ||
type: date | ||
script: "emit(params._source[\"keyword\"])" | ||
derived_object: | ||
type: object | ||
properties: | ||
keyword: keyword | ||
script: "emit(params._source[\"json_field\"])" | ||
source_indexed_field: "json_field" | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: {test_index.mappings.derived.derived_text.type: text} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.type: keyword} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.source_indexed_field: text} | ||
- match: {test_index.mappings.derived.derived_date.type: date} | ||
- match: {test_index.mappings.derived.derived_object.type: object} | ||
- match: {test_index.mappings.derived.derived_object.properties.keyword: keyword} | ||
- match: {test_index.mappings.derived.derived_object.source_indexed_field: json_field} | ||
|
||
|
||
- do: | ||
indices.put_mapping: | ||
index: test_index | ||
body: | ||
properties: | ||
text: | ||
type: text | ||
json_field: | ||
type: text | ||
derived: | ||
derived_text: | ||
type: keyword | ||
script: "emit(params._source[\"text\"])" | ||
derived_text_source_indexed_field: | ||
type: text | ||
script: "emit(params._source[\"text\"])" | ||
source_indexed_field: "text" | ||
derived_date: | ||
type: keyword | ||
script: "emit(params._source[\"keyword\"])" | ||
derived_object: | ||
type: object | ||
properties: | ||
keyword: text | ||
script: "emit(params._source[\"text\"])" | ||
source_indexed_field: "text" | ||
format: "dd-MM-yyyy" | ||
ignore_malformed: true | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: {test_index.mappings.derived.derived_text.type: keyword} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.type: text} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.source_indexed_field: text} | ||
- match: {test_index.mappings.derived.derived_date.type: keyword} | ||
- match: {test_index.mappings.derived.derived_object.type: object} | ||
- match: {test_index.mappings.derived.derived_object.properties.keyword: text} | ||
- match: {test_index.mappings.derived.derived_object.source_indexed_field: text} | ||
- match: {test_index.mappings.derived.derived_object.format: "dd-MM-yyyy"} | ||
- match: {test_index.mappings.derived.derived_object.ignore_malformed: true} | ||
|
||
|
||
- do: | ||
indices.put_mapping: | ||
index: test_index | ||
body: | ||
properties: | ||
text: | ||
type: text | ||
json_field: | ||
type: text | ||
derived: | ||
derived_object: | ||
type: object | ||
properties: | ||
keyword: keyword | ||
script: "emit(params._source[\"json_field\"])" | ||
source_indexed_field: "json_field" | ||
ignore_malformed: false | ||
|
||
- do: | ||
indices.get_mapping: | ||
index: test_index | ||
|
||
- match: {test_index.mappings.derived.derived_text.type: keyword} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.type: text} | ||
- match: {test_index.mappings.derived.derived_text_source_indexed_field.source_indexed_field: text} | ||
- match: {test_index.mappings.derived.derived_date.type: keyword} | ||
- match: {test_index.mappings.derived.derived_object.type: object} | ||
- match: {test_index.mappings.derived.derived_object.properties.keyword: keyword} | ||
- match: {test_index.mappings.derived.derived_object.source_indexed_field: json_field} | ||
- is_false: test_index.mappings.derived.derived_object.ignore_malformed |
Oops, something went wrong.