ElasticSearch more_like_this-选项是在源索引上运行还是在目标索引上运行



more_like_this函数的一个有用特性是ES能够交叉搜索不同的索引,假设字段名称和映射对应。

有一件事让我感到困惑,那就是术语选择参数是如何在这些情况下应用的。

考虑:

的最大oc_freq

输入文档中忽略术语的最大文档频率。这对于忽略诸如停止词之类的高频率单词可能很有用。默认为无界(Integer.MAX_VALUE,即2^31-1或2147483647(。

这是源文档索引上的文档频率吗?还是将其应用于我们正在查询的索引?

示例:

GET index_a/_search
{
"query": {
"function_score": {
"query": {
"bool": {
"should": [
{
"more_like_this": {
"boost": 1,
"fields": [
"text"
],
"include": true,
"like": [
{
"_id": "tI2N_24BFVRF37fDxSTT",
"_index": "index_b"
}
],
"max_doc_freq": 50000,
"max_query_terms": 50,
"min_term_freq": 1,
"min_word_length": 4,
"minimum_should_match": "1%",
"stop_words": []
}
}
]
}
},
"script_score": {
"script": "1.0"
}
}
}
}

在这种情况下,最大doc-freq设置为50000。但这是在index_a上吗?还是index_b?

这是在重写查询短语时考虑的。因此CCD_ 1。重写阶段将MLT重写为布尔查询

最新更新