来自查询

时间:2016-02-22 06:32:17

标签: elasticsearch filter aggregation

我是弹性搜索的新手,如果我的问题很平常,请原谅。我使用ElasticSearch v2.2。下一个查询

{
    "query": {
        "bool": {
            "must": {
                "multi_match": {
                    "query": "nokia",
                    "fields": [
                        "*.right",
                        "*.correct_keyboard_layout"
                    ],
                    "fuzziness": "AUTO"
                }
            },
            "filter": [
                {
                    "terms": {
                        "brands": ["Nokia"]
                    }
                },
                {
                    "terms": {
                        "models_id": ["2432", "5234"]
                    }
                },
                {
                    "terms": {
                        "stores": ["999"]
                    }
                }
            ]
        }
    },
    "aggs": {
        "filtered": {
            "aggs": {
                "models_id": {
                    "terms": {
                        "field": "models_id",
                        "size": 0
                    }
                },
                "category_id": {
                    "terms": {
                        "field": "category_id",
                        "size": 0
                    }
                }
            }
        }
    }
}

我参与了汇总结果,从请求中排除了过滤器(即,通过与“诺基亚”查询匹配的所有记录,但我只需要对这些模型进行回答,并在响应列表中汇总所有模型) ,虽然在这里 https://www.elastic.co/guide/en/elasticsearch/guide/current/_filtering_queries_and_aggregations.html 它说过滤器应该从请求中取出,它不明白我为什么不工作。 我做错了什么?

0 个答案:

没有答案