diff options
Diffstat (limited to 'docs/reference/query-dsl/queries/indices-query.asciidoc')
-rw-r--r-- | docs/reference/query-dsl/queries/indices-query.asciidoc | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/docs/reference/query-dsl/queries/indices-query.asciidoc b/docs/reference/query-dsl/queries/indices-query.asciidoc new file mode 100644 index 0000000..c597833 --- /dev/null +++ b/docs/reference/query-dsl/queries/indices-query.asciidoc @@ -0,0 +1,37 @@ +[[query-dsl-indices-query]] +=== Indices Query + +The `indices` query can be used when executed across multiple indices, +allowing to have a query that executes only when executed on an index +that matches a specific list of indices, and another query that executes +when it is executed on an index that does not match the listed indices. + +[source,js] +-------------------------------------------------- +{ + "indices" : { + "indices" : ["index1", "index2"], + "query" : { + "term" : { "tag" : "wow" } + }, + "no_match_query" : { + "term" : { "tag" : "kow" } + } + } +} +-------------------------------------------------- + +You can use the `index` field to provide a single index. + +`no_match_query` can also have "string" value of `none` (to match no +documents), and `all` (to match all). Defaults to `all`. + +`query` is mandatory, as well as `indices` (or `index`). + +[TIP] +=================================================================== +The fields order is important: if the `indices` are provided before `query` +or `no_match_query`, the related queries get parsed only against the indices +that they are going to be executed on. This is useful to avoid parsing queries +when it is not necessary and prevent potential mapping errors. +=================================================================== |