From 5f16fed81fe2e403c3853b20c508f0dd39db6250 Mon Sep 17 00:00:00 2001 From: Marios Trivyzas Date: Fri, 13 Mar 2020 14:42:09 +0100 Subject: [PATCH] Fix YAML test for search.allow_expensive_queries (#53541) Remove excessive testing and keep only the checks for when the queries are disallowed. Fix also the check for the initial value of the setting to be conmbatible with Go client tests. (cherry picked from commit 314145294ea926e069c6f8629dfc622a7f31a0fb) --- .../test/search/320_disallow_queries.yml | 185 +----------------- 1 file changed, 1 insertion(+), 184 deletions(-) diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/search/320_disallow_queries.yml b/rest-api-spec/src/main/resources/rest-api-spec/test/search/320_disallow_queries.yml index e0b6827aa7995..7135c8642736c 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/search/320_disallow_queries.yml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/search/320_disallow_queries.yml @@ -55,94 +55,7 @@ teardown: cluster.get_settings: flat_settings: true - - match: {search.allow_expensive_queries: null} - - ### Prefix - - do: - search: - index: test - body: - query: - prefix: - text: - value: out - - - match: { hits.total.value: 3 } - - ### Fuzzy - - do: - search: - index: test - body: - query: - fuzzy: - text: - value: outwide - - - match: { hits.total.value: 3 } - - - ### Regexp - - do: - search: - index: test - body: - query: - regexp: - text: - value: .*ou.*id.* - - - match: { hits.total.value: 3 } - - ### Wildcard - - do: - search: - index: test - body: - query: - wildcard: - text: - value: out?ide - - - match: { hits.total.value: 3 } - - ### Range on text - - do: - search: - index: test - body: - query: - range: - text: - gte: "theres" - - - match: { hits.total.value: 2 } - - ### Range on keyword - - do: - search: - index: test - body: - query: - range: - text.raw: - gte : "Outside it is cold and wet" - - - match: { hits.total.value: 2 } - - ### Nested - - do: - search: - index: test - body: - query: - nested: - path: "nested1" - query: - bool: - must: [{"match": {"nested1.foo": "bar2"}}] - - - match: { hits.total.value: 1 } + - is_false: search.allow_expensive_queries ### Update setting to false - do: @@ -232,99 +145,3 @@ teardown: query: bool: must: [{"match" : {"nested1.foo" : "bar2"}}] - - ### Revert setting to true - - do: - cluster.put_settings: - body: - transient: - search.allow_expensive_queries: "true" - flat_settings: true - - - match: {transient: {search.allow_expensive_queries: "true"}} - - ### Prefix - - do: - search: - index: test - body: - query: - prefix: - text: - value: out - - - match: { hits.total.value: 3 } - - ### Fuzzy - - do: - search: - index: test - body: - query: - fuzzy: - text: - value: outwide - - - match: { hits.total.value: 3 } - - ### Regexp - - do: - search: - index: test - body: - query: - regexp: - text: - value: .*ou.*id.* - - - match: { hits.total.value: 3 } - - ### Wildcard - - do: - search: - index: test - body: - query: - wildcard: - text: - value: out?ide - - - match: { hits.total.value: 3 } - - ### Range on text - - do: - search: - index: test - body: - query: - range: - text: - gte: "theres" - - - match: { hits.total.value: 2 } - - ### Range on keyword - - do: - search: - index: test - body: - query: - range: - text.raw: - gte: "Outside it is cold and wet" - - - match: { hits.total.value: 2 } - - ### Nested - - do: - search: - index: test - body: - query: - nested: - path: "nested1" - query: - bool: - must: [{"match": {"nested1.foo": "bar2"}}] - - - match: { hits.total.value: 1 }