Elasticsearch 6.2按数组搜索每个项目

时间:2018-04-02 05:15:52

标签: elasticsearch elasticsearch-6

我有这样的数组,

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

我试着这样搜索。

WP_DEBUG

我不想要任何搜索结果。但是,它通过[" ikea 主席"," marketO 桌面"]搜索。

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

另外,我的映射设置如下,

wp-config.php

1 个答案:

答案 0 :(得分:0)

试试这个

{
      "query":{
          "bool":{
              "must":[
                  {
                      "match_phrase":{
                          "include_products":"ikea desk"
                      }
                  }    
              ]
          }
      }
    }