What's the syntax for filtering out records with certain phrases in ElasticSearch

时间:2016-02-03 02:56:04

标签: elasticsearch

The json looks like this

{
  "company": {
    "type": "SME",
    "name": "Taylor Corps"
  },
  "contact": {
    "tel": "5334234234",
    "name": "Jane Doe"
  },
  "affiliates": {
    "org": "Taylor Corps"
  }
}

image I want to filter out all the people who has "Taylor" in their company.name or affiliates.org.

I tried multi_field in a bool filter doesn't seem working in filter.

Any advice?

Thank you!

1 个答案:

答案 0 :(得分:0)

使用以下查询:

{
"query": {
    "query_string": {
       "fields": [
          "company.name" , "affiliates.org"
       ], 
       "query": "Taylor"
      }
    }
}