1

我有这样的数组集,

"title": "Living furniture exhibitions!"
"include_products": ["ikea chair", "marketO desk"]

我试着像这样搜索。

{
    "query": {
      "multi_match": {
        "query": "ikea desk",
        "operator": "and"
      }
    }
}

我不想要任何搜索结果。但是,它通过 [" ikea chair", "marketO desk "] 进行搜索。

如何搜索 include_products 数组中的每个项目?

另外,我的映射设置是这样的,

"mappings": {
    "information" : {
      "properties" : {
        "title" : {
          "type" : "text"
        },
        "include_products": {
          "type": "text"
        }
      },
      "_all": {
        "enabled": false
      }
    }
 }
4

1 回答 1

0

试试这个

{
      "query":{
          "bool":{
              "must":[
                  {
                      "match_phrase":{
                          "include_products":"ikea desk"
                      }
                  }    
              ]
          }
      }
    }
于 2018-04-02T05:23:41.180 回答