无匹配的Elasticsearch msearch查询

我是elastic 5.1的新手(一般来说是Elastic的新手),我有一个使用msearch发送到elastic的列表。

然而,以下代码没有返回任何命中结果,但我的文档在索引中如下所示:

{
"_index": "all_items",
"_type": "product",
"_id": "1000002007900",
"_version": 2,
"found": true,
"_source": {
    "doc": {
        "title": "title here",
        "brand": null,
        "updatedOn": "2016-12-22T14:00:26.016290",
        "price": 49,
        "viewed7": 0,
        "idInShop": "11",
        "active": true,
        "model": null,
        "_id": 1000002007900,
        "purchased7": 0
    },
    "doc_as_upsert": true
}

}

这是发送到msearch的正文

[
{
    "index": "all_items",
    "type": "product"
},
{
    "sort": [
        {
            "_score": "desc"
        }
    ],
    "query": {
        "function_score": {
            "query": {
                "bool": {
                    "filter": [
                        {
                            "term": {
                                "active": true
                            }
                        }
                    ],
                    "should": [],
                    "must_not": [],
                    "must": []
                }
            },
            "functions": [
                {
                    "script_score": {
                        "script": {
                            "lang": "painless",
                            "inline": "_score * params.constant * (doc['discountPrice'] > 0 ? doc['price'] / doc['discountPrice'] : 0)",
                            "params": {
                                "constant": 1.2
                            }
                        }
                    }
                }
            ],
            "score_mode": "multiply"
        }
    },
    "from": 0,
    "size": 3
}

]

如果我只发送{"query":{"match_all":{}}},我会得到点击。

转载请注明出处:http://www.intrusion-fire.net/article/20230526/1679121.html