OpenSearch/docs/reference/query-dsl/indices-query.asciidoc
Nik Everett 1e587406d8 Fail yaml tests and docs snippets that get unexpected warnings
Adds `warnings` syntax to the yaml test that allows you to expect
a `Warning` header that looks like:
```
    - do:
        warnings:
            - '[index] is deprecated'
            - quotes are not required because yaml
            - but this argument is always a list, never a single string
            - no matter how many warnings you expect
        get:
            index:    test
            type:    test
            id:        1
```

These are accessible from the docs with:
```
// TEST[warning:some warning]
```

This should help to force you to update the docs if you deprecate
something. You *must* add the warnings marker to the docs or the build
will fail. While you are there you *should* update the docs to add
deprecation warnings visible in the rendered results.
2016-08-04 15:23:05 -04:00

34 lines
1.1 KiB
Plaintext

[[query-dsl-indices-query]]
=== Indices Query
deprecated[5.0.0, Search on the '_index' field instead]
The `indices` query is useful in cases where a search is executed across
multiple indices. It allows to specify a list of index names and an inner
query that is only executed for indices matching names on that list.
For other indices that are searched, but that don't match entries
on the list, the alternative `no_match_query` is executed.
[source,js]
--------------------------------------------------
GET /_search
{
"query": {
"indices" : {
"indices" : ["index1", "index2"],
"query" : { "term" : { "tag" : "wow" } },
"no_match_query" : { "term" : { "tag" : "kow" } }
}
}
}
--------------------------------------------------
// CONSOLE
// TEST[warning:indices query is deprecated. Instead search on the '_index' field]
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`).