How to fix ElasticSearch '[match] query doesn't support multiple fields, found [...] and [...]'
Problem:
You want to run an ElasticSearch query like
match-query-example.json
{
    "query": {
        "match" : {
            "one_field" : "one_value",
            "another_field": "another_value"
        }
    }
}but you only see an error message like
elasticsearch-error.txt
elasticsearch.exceptions.RequestError: RequestError(400, 'parsing_exception', "[match] query doesn't support multiple fields, found [one_field] and [another_field]")Solution
Match queries only support one field. You should use a bool query with a must clause containing multiple match queries instead:
bool-must-multi-match.json
{
    "query": {
        "bool": {
            "must": [
                {"match": {"one_field" : "one_value"}},
                {"match": {"another_field" : "another_value"}},
            ]
        }
    }
}Also see the official docs for the MultiMatch query.
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