0
0
Elasticsearchquery~20 mins

Percolate queries (reverse search) in Elasticsearch - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Percolate Query Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this percolate query count?

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".

Elasticsearch
{
  "query": {
    "percolate": {
      "field": "query",
      "document": {
        "message": "quick brown fox"
      }
    }
  }
}
A2
B1
C0
DQuery syntax error
Attempts:
2 left
💡 Hint

Think about which registered queries match the document text.

🧠 Conceptual
intermediate
1:30remaining
Which field type is required to store percolator queries?

In Elasticsearch, to register queries for percolation, which field type must be used in the mapping?

A"text"
B"keyword"
C"percolator"
D"nested"
Attempts:
2 left
💡 Hint

It's a special field type designed for storing queries.

🔧 Debug
advanced
2:30remaining
Why does this percolate query fail with a parsing error?

Consider this percolate query:

{
  "query": {
    "percolate": {
      "field": "query",
      "document": {
        "message": "fox jumps"
      },
      "index": "my_index"
    }
  }
}

It returns a parsing error. What is the cause?

AThe "field" value must be the name of a "percolator" field, not "query"
BThe "document" field must be replaced with "documents" array
CThe "index" parameter is not allowed inside the percolate query
DThe "message" field is missing from the mapping
Attempts:
2 left
💡 Hint

Check the field name used for percolate queries in the mapping.

📝 Syntax
advanced
2:00remaining
Which option correctly registers a percolator query in Elasticsearch?

You want to register a percolator query that matches documents containing "error" in the "message" field. Which JSON is correct?

A{ "query": { "match": { "message": "error" } } }
B{ "query": { "percolate": { "field": "query", "document": { "message": "error" } } } }
C{ "query": { "match": { "query": "error" } } }
D{ "query": { "term": { "message": "error" } } }
Attempts:
2 left
💡 Hint

Registering a percolator query requires a valid query JSON, not a percolate query.

🚀 Application
expert
3:00remaining
How many queries match this document using percolate query?

Assume you have registered these percolator queries:

  1. Match "error" in "message"
  2. Match "warning" in "message"
  3. Match phrase "disk failure" in "message"

What is the number of matching queries for this document?

{"message": "disk failure error detected"}
A0
B3
C1
D2
Attempts:
2 left
💡 Hint

Check which registered queries match the document text.