Fixing ElasticSearch 'no [query] registered for [query]'
Problem:
You want to run a query in ElasticSearch, but you get an error message like
elasticsearch_no_query_registered.txt
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', 'no [query] registered for [query]')Solution
In your query body, you have two "query" objects nested in each other. Remove the outer "query", keeping only the inner one.
Example:
Incorrect:
example.json
{
"query": {
"query": {
"match": {
"my_field": "my_value"
}
}
}
}Correct:
example.json
{
"query": {
"match": {
"my_field": "my_value"
}
}
}Check out similar posts by category:
Databases, ElasticSearch
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow