简体   繁体   中英

ElasticSearch: is there any option to search in all fileds in document by simply giving the query in ElasticSearch

I am new to Elasticserach and am looking for a solution to our existing scenario. Suppose I have created a document:

{     
    "employee": {
        "properties": {
        "id"  : {"type": "string"},
        "value": {"type": "string"},
        "role": {"type": "string"},
        "desc": {"type": "string"}
     }
   }
}

And i would like to search on fields without specifying field name explicitly.

For example, if my search query string is "Bin", i would like to search in all fields id, value, role and desc. Is there any way to do in ElasticSearch?

You can do it using the _all field. It allows you to search a document without specifying field names.

Do read the documentation carefully, though, as:

This comes at the expense of CPU cycles and index size.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM