Reputation: 3517
I am kind of new to Elasticsearch and couldn't find answer to this question anywhere. So the question is, does ES provide any atomicity guarantee for a GET request combining facet search and document multi match search like following one when in parallel lot of inserts are going on.
POST shakespeare/_search?request_cache=false
{
"query": {
"multi_match" : {
"query" : "henry"
}
},
"size": 0,
"aggs": {
"Speaker Facet": {
"terms": {
"field": "speaker",
"size": 12
}
},
"text entry Facet": {
"terms": {
"field": "text_entry.keyword",
"size": 12
}
},
"play name Facet": {
"terms": {
"field": "play_name",
"size": 12
}
}
}
}
This is a 2 part request 1. multi match search and 2. aggregation. If parallely lot of inserts are going on, then does ES gurantee that the multi match search and aggregation results both operate on the same data set and results of both parts of the query match each other ? Or does ES do a search first then some inserts take place then aggregations form which would show aggregation counts mismatching with multi match search?
Upvotes: 0
Views: 77
Reputation: 217424
Whatever the frequency of the ongoing indexation requests, you're guaranteed that the aggregations are run on exactly the same document set that has been selected by whatever constraints were specified in the query part.
It would be a nightmare otherwise.
From the documentation:
An aggregation can be seen as a unit-of-work that builds analytic information over a set of documents. The context of the execution defines what this document set is (e.g. a top-level aggregation executes within the context of the executed query/filters of the search request).
Upvotes: 2