-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating Ip fields to use doc_values to search
Signed-off-by: Harsha Vamsi Kalluri <[email protected]>
- Loading branch information
1 parent
69cc2a1
commit 4b2b0c5
Showing
2 changed files
with
191 additions
and
12 deletions.
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
rest-api-spec/src/main/resources/rest-api-spec/test/search/370_ip_field_doc_values.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,134 @@ | ||
setup: | ||
- skip: | ||
features: [ "headers" ] | ||
version: " - 2.11.99" | ||
reason: "searching with only doc_values was added in 2.12.0" | ||
|
||
--- | ||
"search on ip fields with doc_values enabled": | ||
- do: | ||
indices.create: | ||
index: test-iodvq | ||
body: | ||
mappings: | ||
dynamic: false | ||
properties: | ||
ip_index: | ||
type: ip | ||
doc_values: false | ||
ip_doc_values: | ||
type: ip | ||
index: false | ||
ip_both: | ||
type: ip | ||
index: true | ||
doc_values: true | ||
|
||
|
||
- do: | ||
headers: | ||
Content-Type: application/json | ||
index: | ||
index: "test-iodvq" | ||
id: 1 | ||
body: | ||
ip_index: "192.168.0.1" | ||
ip_doc_values: "192.168.0.2" | ||
ip_both: "192.168.0.3" | ||
|
||
- do: | ||
headers: | ||
Content-Type: application/json | ||
index: | ||
index: "test-iodvq" | ||
id: 2 | ||
body: | ||
ip_index: "192.168.1.1" | ||
ip_doc_values: "192.168.1.2" | ||
ip_both: "192.168.1.3" | ||
|
||
|
||
- do: | ||
headers: | ||
Content-Type: application/json | ||
index: | ||
index: "test-iodvq" | ||
id: 3 | ||
body: | ||
ip_index: "192.168.2.1" | ||
ip_doc_values: "192.168.2.2" | ||
ip_both: "192.168.2.3" | ||
|
||
|
||
- do: | ||
indices.refresh: {} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
term: | ||
ip_index: "192.168.0.1" | ||
|
||
- match: {hits.total: 1} | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
term: | ||
ip_doc_values: "192.168.0.2" | ||
|
||
- match: { hits.total: 1 } | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
term: | ||
ip_both: "192.168.0.3" | ||
|
||
- match: { hits.total: 1 } | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
terms: | ||
ip_index: ["192.168.0.1", "192.168.1.1"] | ||
|
||
- match: { hits.total: 2 } | ||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
range: | ||
ip_doc_values: | ||
gte: "192.168.0.2" | ||
|
||
- match: { hits.total: 3 } | ||
|
||
|
||
- do: | ||
search: | ||
rest_total_hits_as_int: true | ||
index: test-iodvq | ||
body: | ||
query: | ||
range: | ||
ip_both: | ||
gte: "192.168.0.2" | ||
lte: "192.168.2.2" | ||
|
||
- match: { hits.total: 2 } |
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