0

此查询效果很好,但返回的结果太多。我想添加 boost 功能,但我不知道正确的语法。

$data_string = '{
"from" : 0, "size" : 100,
"sort" : [
    { "date" : {"order" : "desc"} }
],
"query": {
        "more_like_this_field" : {
            "thread.title" : {
                "like_text" : "this is a test",
                "min_word_len" : 4,
                "min_term_freq" : 1,
                "min_doc_freq" : 1
            }
        }
    }
}';
4

2 回答 2

1

找到了解决方案。看起来使用fuzzy_like_this_field 和min_similarity 是要走的路。

$data_string = '{
"from" : 0, "size" : 100,
"query": {
        "fuzzy_like_this_field" : {
            "thread.title" : {
                "like_text" : "this is a test",
                "min_similarity": 0.9
            }
        }
    }
}';
于 2013-10-23T17:53:15.570 回答
0

根据文档,您只需将其添加到其他参数:

...
"thread.title" : {
    "like_text" : "this is a test",
    "min_word_len" : 4,
    "min_term_freq" : 1,
    "min_doc_freq" : 1,
    "boost": 1.0
}
...

此外,如果您的文档过多,您也可以尝试增加min_term_freqmin_doc_freq

于 2013-10-23T17:20:22.490 回答