Elasticsearch中的自动完成功能

时间:2014-04-13 16:03:48

标签: javascript autocomplete elasticsearch

我正在获取自动完成弹性搜索中的所有字段。我想要那些只有相关值的字段。这样可行吗?

我试过了:

{
    "query": {
        "bool": {
            "should": [
                {
                    "multi_match": {
                        "query": "B",
                        "fields": [
                            "City",
                            "MLSNumber"
                        ],
                        "zero_terms_query": "all",
                        "boost": 3
                    }
                },
                {
                    "multi_match": {
                        "query": "B",
                        "fields": [
                            "City",
                            "MLSNumber"
                        ],
                        "zero_terms_query": "all",
                        "fuzziness": 0,
                        "boost": 1
                    }
                }
            ],
            "minimum_should_match": 1
        }
    },
    "sort": [
        {
            "_score": "desc"
        }
    ],
    "from": 0,
    "size": 25
}

0 个答案:

没有答案