最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

search - ElasticSearch filter not displaying correct results - Stack Overflow

programmeradmin4浏览0评论

I'm using ES and I'm running into some issues when trying out the filtering. This is a piece of my document structure:

        "id": "36e20ccd-7f96-4611-8891-c9cb1b69957f",
        "lang_frameworks": "Language-agnostic",
        "category": {
            "category_name": "Application Security Testing",
            "translations": {
                "en": {
                    "description_what": null,
                    "description_where": null
                }
            }
        },
        "en": {
            "title": "Application Security Testing",
            "content": "<h2>Int

This is the query I'm using to search through the data:

{
  "query": {
    "bool": {
      "must": [
        {
          "multi_match": {
            "query": "PCI DSS",
            "fields": [
              ...
            ],
            "type": "best_fields",
            "operator": "and",
            "boost": 1.5
          }
        }
      ],
      "filter": {
        "term": {
          "lang_frameworks": "agnostic"
        }
      }
    }
  }
}

I want to filter on the language framework part of the data but it is never returning any hits. I have tried a lot of different query structures but it hasn't come back with anything useful.

I also have this part which is a working filter for the categories:

"filter": [{
        "nested": {
            "path": "category",
                "query": {
                    "bool": {
                        "should": [
                            {"match_phrase": {"category.category_name": "PCIE"}}
                        ],
                        "minimum_should_match": 1
                    }
                }
            }
        }]
发布评论

评论列表(0)

  1. 暂无评论