forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: kkewwei <[email protected]>
- Loading branch information
Showing
4 changed files
with
81 additions
and
2 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
70 changes: 70 additions & 0 deletions
70
rest-api-spec/src/main/resources/rest-api-spec/test/index/110_constant_keyword.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,70 @@ | ||
--- | ||
# The test setup includes: | ||
# - Create index with constant_keyword field type | ||
# - Check mapping | ||
# - Index two example documents | ||
# - Search | ||
# - Delete Index when connection is teardown | ||
|
||
"Mappings and Supported queries": | ||
- skip: | ||
version: " - 2.99.99" | ||
reason: "fixed in 3.0.0" | ||
|
||
# Create index with constant_keyword field type | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
mappings: | ||
properties: | ||
genre: | ||
type: "constant_keyword" | ||
value: "1" | ||
|
||
# Index document | ||
- do: | ||
index: | ||
index: test | ||
id: 1 | ||
body: { | ||
"genre": "1" | ||
} | ||
|
||
- do: | ||
index: | ||
index: test | ||
id: 2 | ||
body: { | ||
"genre": 1 | ||
} | ||
|
||
- do: | ||
indices.refresh: | ||
index: test | ||
|
||
# Check mapping | ||
- do: | ||
indices.get_mapping: | ||
index: test | ||
- is_true: test.mappings | ||
- match: { test.mappings.properties.genre.type: constant_keyword } | ||
- length: { test.mappings.properties.genre: 2 } | ||
|
||
# Verify Document Count | ||
- do: | ||
search: | ||
body: { | ||
query: { | ||
match_all: {} | ||
} | ||
} | ||
|
||
- length: { hits.hits: 2 } | ||
- match: { hits.hits.0._source.genre: "1" } | ||
- match: { hits.hits.1._source.genre: 1 } | ||
|
||
# Delete Index when connection is teardown | ||
- do: | ||
indices.delete: | ||
index: test |
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
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