ElasticSearch: How to search for a value in any field, across all types, in one or more indices?

Either the query_string query or the match query would be what you’re looking for.

query_string will use the special _all field if none is specified in default_field, so that would work out well.

curl -XPOST 'localhost:9200/_search?pretty' -d '{
  "query": { "query_string": { "query": "abc" } }
}'

And with match you can just specify the _all as well.

curl -XPOST 'localhost:9200/_search?pretty' -d '{
  "query": { "match": { "_all": "abc" } }
}'

Note that with query_string you may use wildcards, which you can’t with match


UPDATE:

As the _all field was deprecated in 6.0, the solution is now to implement a custom all field

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)