Given an index with percolator queries registered, what will be the count of matching queries for the document below?
{"query": {"match": {"message": "quick brown fox"}}}Assume the percolator index has two queries: one matching "quick" and another matching "lazy".
{
"query": {
"percolate": {
"field": "query",
"document": {
"message": "quick brown fox"
}
}
}
}Think about which registered queries match the document text.
The document contains the word "quick" which matches one registered query. The other query matches "lazy" which is not in the document, so only one query matches.
In Elasticsearch, to register queries for percolation, which field type must be used in the mapping?
It's a special field type designed for storing queries.
The "percolator" field type is specifically designed to store queries for reverse search in Elasticsearch.
Consider this percolate query:
{
"query": {
"percolate": {
"field": "query",
"document": {
"message": "fox jumps"
},
"index": "my_index"
}
}
}It returns a parsing error. What is the cause?
Check the field name used for percolate queries in the mapping.
The "field" parameter must point to the field of type "percolator" in the index mapping. Using "query" if that is not the percolator field causes parsing errors.
You want to register a percolator query that matches documents containing "error" in the "message" field. Which JSON is correct?
Registering a percolator query requires a valid query JSON, not a percolate query.
When registering a percolator query, you store a normal query (like match) inside the percolator field. Option A is the correct query to store.
Assume you have registered these percolator queries:
- Match "error" in "message"
- Match "warning" in "message"
- Match phrase "disk failure" in "message"
What is the number of matching queries for this document?
{"message": "disk failure error detected"}Check which registered queries match the document text.
The document contains "disk failure" phrase and the word "error". So queries 1 and 3 match, but not query 2.