首页 > 解决方案 > 具有源过滤的弹性搜索搜索忽略排除

问题描述

我有一个看起来很像下面的查询。出于某种原因,ES 6.4 忽略了源过滤器并返回所有内容。

有人有线索吗?

curl -X GET -H "Content-Type: application/json" http://localhost:49153/indexundertest/sometype/_search -d '{
   "query":{
      "bool":{
         "filter":[
            {
               "terms":{
                  "_id":[
                     "AA001"
                  ],
                  "boost":1.0
               }
            }
         ],
         "adjust_pure_negative":true,
         "boost":1.0
      }
   },
   "_source":{
      "includes":[

      ],
      "excludes":[
         "content.es",
         "content.pt",
         "content.zh",
         "content.vi",
         "other.content.es",
         "other.content.pt",
         "other.content.zh",
         "other.content.vi"
      ]
   }
}'

标签: elasticsearch

解决方案


看起来这是映射的问题。

如果我在没有映射的情况下创建索引,则使用源过滤的查询将按预期工作。如果我包含映射,我会在源代码中看到一个奇怪的结果。它在命中的源字段的键中包含源的内容,但具有“JSON”作为值。

正在修复我的映射。


推荐阅读