From 95fca87e9f5fae3283ade00363bfd2d094dd0689 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 24 Aug 2020 13:42:30 -0700 Subject: more test queries --- tests/files/DELETE_scroll_body.txt | 4 +++ tests/files/DELETE_scroll_path.txt | 1 + tests/files/GET_collapse_expand.txt | 24 ++++++++++++++ tests/files/GET_collapse_nested.txt | 16 ++++++++++ tests/files/GET_highlight.txt | 16 ++++++++++ tests/files/GET_highlight_complex.txt | 16 ++++++++++ tests/files/GET_highlight_fields.txt | 18 +++++++++++ tests/files/GET_highlight_query.txt | 55 ++++++++++++++++++++++++++++++++ tests/files/GET_search_bool.txt | 15 +++++++++ tests/files/GET_search_boosting.txt | 18 +++++++++++ tests/files/GET_search_docvalues.txt | 16 ++++++++++ tests/files/GET_search_sort.txt | 13 ++++++++ tests/files/POST_scroll_continue.txt | 5 +++ tests/files/POST_search_inner.txt | 17 ++++++++++ tests/files/POST_search_rescore.txt | 26 +++++++++++++++ tests/files/POST_search_sort_mode.txt | 9 ++++++ tests/files/POST_search_start_scroll.txt | 9 ++++++ 17 files changed, 278 insertions(+) create mode 100644 tests/files/DELETE_scroll_body.txt create mode 100644 tests/files/DELETE_scroll_path.txt create mode 100644 tests/files/GET_collapse_expand.txt create mode 100644 tests/files/GET_collapse_nested.txt create mode 100644 tests/files/GET_highlight.txt create mode 100644 tests/files/GET_highlight_complex.txt create mode 100644 tests/files/GET_highlight_fields.txt create mode 100644 tests/files/GET_highlight_query.txt create mode 100644 tests/files/GET_search_bool.txt create mode 100644 tests/files/GET_search_boosting.txt create mode 100644 tests/files/GET_search_docvalues.txt create mode 100644 tests/files/GET_search_sort.txt create mode 100644 tests/files/POST_scroll_continue.txt create mode 100644 tests/files/POST_search_inner.txt create mode 100644 tests/files/POST_search_rescore.txt create mode 100644 tests/files/POST_search_sort_mode.txt create mode 100644 tests/files/POST_search_start_scroll.txt diff --git a/tests/files/DELETE_scroll_body.txt b/tests/files/DELETE_scroll_body.txt new file mode 100644 index 0000000..26960a9 --- /dev/null +++ b/tests/files/DELETE_scroll_body.txt @@ -0,0 +1,4 @@ +DELETE /_search/scroll +{ + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" +} diff --git a/tests/files/DELETE_scroll_path.txt b/tests/files/DELETE_scroll_path.txt new file mode 100644 index 0000000..7910ed8 --- /dev/null +++ b/tests/files/DELETE_scroll_path.txt @@ -0,0 +1 @@ +DELETE /_search/scroll/DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ== diff --git a/tests/files/GET_collapse_expand.txt b/tests/files/GET_collapse_expand.txt new file mode 100644 index 0000000..dc6b1a8 --- /dev/null +++ b/tests/files/GET_collapse_expand.txt @@ -0,0 +1,24 @@ +GET /my-index-000001/_search +{ + "query": { + "match": { + "message": "GET /search" + } + }, + "collapse": { + "field": "user.id", + "inner_hits": [ + { + "name": "largest_responses", + "size": 3, + "sort": [ "http.response.bytes" ] + }, + { + "name": "most_recent", + "size": 3, + "sort": [ { "@timestamp": "asc" } ] + } + ] + }, + "sort": [ "http.response.bytes" ] +} diff --git a/tests/files/GET_collapse_nested.txt b/tests/files/GET_collapse_nested.txt new file mode 100644 index 0000000..a31c8e4 --- /dev/null +++ b/tests/files/GET_collapse_nested.txt @@ -0,0 +1,16 @@ +GET /my-index-000001/_search +{ + "query": { + "match": { + "message": "GET /search" + } + }, + "collapse": { + "field": "geo.country_name", + "inner_hits": { + "name": "by_location", + "collapse": { "field": "user.id" }, + "size": 3 + } + } +} diff --git a/tests/files/GET_highlight.txt b/tests/files/GET_highlight.txt new file mode 100644 index 0000000..15346fb --- /dev/null +++ b/tests/files/GET_highlight.txt @@ -0,0 +1,16 @@ +GET my-index-000001/_search +{ + "query": { + "match_phrase": { "message": "number 1" } + }, + "highlight": { + "fields": { + "message": { + "type": "plain", + "fragment_size": 15, + "number_of_fragments": 3, + "fragmenter": "simple" + } + } + } +} diff --git a/tests/files/GET_highlight_complex.txt b/tests/files/GET_highlight_complex.txt new file mode 100644 index 0000000..94e4221 --- /dev/null +++ b/tests/files/GET_highlight_complex.txt @@ -0,0 +1,16 @@ +GET /_search +{ + "query" : { + "match": { "user.id": "kimchy" } + }, + "highlight" : { + "number_of_fragments" : 3, + "fragment_size" : 150, + "fields" : { + "body" : { "pre_tags" : [""], "post_tags" : [""] }, + "blog.title" : { "number_of_fragments" : 0 }, + "blog.author" : { "number_of_fragments" : 0 }, + "blog.comment" : { "number_of_fragments" : 5, "order" : "score" } + } + } +} diff --git a/tests/files/GET_highlight_fields.txt b/tests/files/GET_highlight_fields.txt new file mode 100644 index 0000000..bbd474a --- /dev/null +++ b/tests/files/GET_highlight_fields.txt @@ -0,0 +1,18 @@ +GET /_search +{ + "query": { + "query_string": { + "query": "running scissors", + "fields": ["comment", "comment.plain^10"] + } + }, + "highlight": { + "order": "score", + "fields": { + "comment": { + "matched_fields": ["comment", "comment.plain"], + "type" : "fvh" + } + } + } +} diff --git a/tests/files/GET_highlight_query.txt b/tests/files/GET_highlight_query.txt new file mode 100644 index 0000000..2540b45 --- /dev/null +++ b/tests/files/GET_highlight_query.txt @@ -0,0 +1,55 @@ +GET /_search +{ + "query": { + "match": { + "comment": { + "query": "foo bar" + } + } + }, + "rescore": { + "window_size": 50, + "query": { + "rescore_query": { + "match_phrase": { + "comment": { + "query": "foo bar", + "slop": 1 + } + } + }, + "rescore_query_weight": 10 + } + }, + "_source": false, + "highlight": { + "order": "score", + "fields": { + "comment": { + "fragment_size": 150, + "number_of_fragments": 3, + "highlight_query": { + "bool": { + "must": { + "match": { + "comment": { + "query": "foo bar" + } + } + }, + "should": { + "match_phrase": { + "comment": { + "query": "foo bar", + "slop": 1, + "boost": 10.0 + } + } + }, + "minimum_should_match": 0 + } + } + } + } + } +} diff --git a/tests/files/GET_search_bool.txt b/tests/files/GET_search_bool.txt new file mode 100644 index 0000000..f04ac5a --- /dev/null +++ b/tests/files/GET_search_bool.txt @@ -0,0 +1,15 @@ +GET _search +{ + "query": { + "bool": { + "must": { + "match_all": {} + }, + "filter": { + "term": { + "status": "active" + } + } + } + } +} diff --git a/tests/files/GET_search_boosting.txt b/tests/files/GET_search_boosting.txt new file mode 100644 index 0000000..4db1814 --- /dev/null +++ b/tests/files/GET_search_boosting.txt @@ -0,0 +1,18 @@ +GET /_search +{ + "query": { + "boosting": { + "positive": { + "term": { + "text": "apple" + } + }, + "negative": { + "term": { + "text": "pie tart fruit crumble tree" + } + }, + "negative_boost": 0.5 + } + } +} diff --git a/tests/files/GET_search_docvalues.txt b/tests/files/GET_search_docvalues.txt new file mode 100644 index 0000000..5b92b39 --- /dev/null +++ b/tests/files/GET_search_docvalues.txt @@ -0,0 +1,16 @@ +GET /_search +{ + "query": { + "match_all": {} + }, + "docvalue_fields": [ + "my_ip*", + { + "field": "my_keyword_field" + }, + { + "field": "*_date_field", + "format": "epoch_millis" + } + ] +} diff --git a/tests/files/GET_search_sort.txt b/tests/files/GET_search_sort.txt new file mode 100644 index 0000000..9a0567c --- /dev/null +++ b/tests/files/GET_search_sort.txt @@ -0,0 +1,13 @@ +GET /my-index-000001/_search +{ + "sort" : [ + { "post_date" : {"order" : "asc"}}, + "user", + { "name" : "desc" }, + { "age" : "desc" }, + "_score" + ], + "query" : { + "term" : { "user" : "kimchy" } + } +} diff --git a/tests/files/POST_scroll_continue.txt b/tests/files/POST_scroll_continue.txt new file mode 100644 index 0000000..9aef4d3 --- /dev/null +++ b/tests/files/POST_scroll_continue.txt @@ -0,0 +1,5 @@ +POST /_search/scroll +{ + "scroll" : "1m", + "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ==" +} diff --git a/tests/files/POST_search_inner.txt b/tests/files/POST_search_inner.txt new file mode 100644 index 0000000..b6b3804 --- /dev/null +++ b/tests/files/POST_search_inner.txt @@ -0,0 +1,17 @@ +POST test/_search +{ + "query": { + "nested": { + "path": "comments", + "query": { + "match": { "comments.text": "words" } + }, + "inner_hits": { + "_source": false, + "docvalue_fields": [ + "comments.text.keyword" + ] + } + } + } +} diff --git a/tests/files/POST_search_rescore.txt b/tests/files/POST_search_rescore.txt new file mode 100644 index 0000000..81fcd96 --- /dev/null +++ b/tests/files/POST_search_rescore.txt @@ -0,0 +1,26 @@ +POST /_search +{ + "query" : { + "match" : { + "message" : { + "operator" : "or", + "query" : "the quick brown" + } + } + }, + "rescore" : { + "window_size" : 50, + "query" : { + "rescore_query" : { + "match_phrase" : { + "message" : { + "query" : "the quick brown", + "slop" : 2 + } + } + }, + "query_weight" : 0.7, + "rescore_query_weight" : 1.2 + } + } +} diff --git a/tests/files/POST_search_sort_mode.txt b/tests/files/POST_search_sort_mode.txt new file mode 100644 index 0000000..1d6988f --- /dev/null +++ b/tests/files/POST_search_sort_mode.txt @@ -0,0 +1,9 @@ +POST /_search +{ + "query" : { + "term" : { "product" : "chocolate" } + }, + "sort" : [ + {"price" : {"order" : "asc", "mode" : "avg"}} + ] +} diff --git a/tests/files/POST_search_start_scroll.txt b/tests/files/POST_search_start_scroll.txt new file mode 100644 index 0000000..8c8fd00 --- /dev/null +++ b/tests/files/POST_search_start_scroll.txt @@ -0,0 +1,9 @@ +POST /my-index-000001/_search?scroll=1m +{ + "size": 100, + "query": { + "match": { + "message": "foo" + } + } +} -- cgit v1.2.3