Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
[[search-multiple-indices]]
=== Search multiple data streams and indices
=== Search multiple data streams and indices using a query

There are two main methods for searching across multiple data streams and indices in {es}:

* *Query Level*: Directly specify indices in the search request path or use index patterns to target multiple indices.

* *Index level*: Use <<aliases, index aliases>>, which act as pointers to one or more backing indices, enabling logical grouping and management of indices.

To search multiple data streams and indices, add them as comma-separated values
in the <<search-search,search API>>'s request path.
Expand Down Expand Up @@ -39,6 +45,34 @@ GET /my-index-*/_search
----
// TEST[setup:my_index]

You can exclude specific indices from a search. The request will retrieve data from all indices starting with `my-index-`, except for `my-index-01`.

[source,console]
----
GET /my-index-*/_search
{
"query": {
"bool": {
"must": [
{
"match": {
"user.id": "kimchy"
}
}
],
"must_not": [
{
"terms": {
"_index": ["my-index-01"]
}
}
]
}
}
}
----
// TEST[setup:my_index]

To search all data streams and indices in a cluster, omit the target from the
request path. Alternatively, you can use `_all` or `*`.

Expand Down