我希望以术语频率不是真正有用的方式使用 Elasticsearch。我正在运行 Elasticsearch 0.19。我尝试将一些特定字段的“omit_term_freq_and_positions”设置为 true,但这似乎没有任何影响。
tags: {
type: "string",
search_analyzer : "snowball",
index_analyzer : "snowball",
boost : 4,
omit_term_freq_and_positions : "true",
}
当 explain=true 时,搜索结果似乎仍会考虑频率。
这是我正在运行的示例查询:
{
"from": 0,
"size": 15,
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "italian",
"fields": [
"name",
"tags"
]
}
},
"filter": {
"geo_distance": {
"distance": "5km",
"location": {
"lat": 40.76405282025,
"lon": -73.972994269042
}
}
}
}
}
}
所述查询的第一次命中:
"hits": [
{
"_shard": 0,
"_node": "TtX90CDASk2wsHErdEe7BQ",
"_index": "businesses",
"_type": "business",
"_id": "25385",
"_score": 20.388601,
"_source": {
"_boost": "1.5",
"bid": "25385",
"name": "Donatella",
"address": "184 8th Ave",
"city": "New York",
"state": "NY",
"zip": "10011",
"tags": "Restaurant,Italian",
"location": [
{
"lat": 40.743015,
"lon": -73.99992
}
]
},
"_explanation": {
"value": 20.3886,
"description": "max of:",
"details": [
{
"value": 20.3886,
"description": "weight(tags:italian in 14282), product of:",
"details": [
{
"value": 0.7244212,
"description": "queryWeight(tags:italian), product of:",
"details": [
{
"value": 5.6289353,
"description": "idf(docFreq=399, maxDocs=40962)"
},
{
"value": 0.12869595,
"description": "queryNorm"
}
]
},
{
"value": 28.144676,
"description": "fieldWeight(tags:italian in 14282), product of:",
"details": [
{
"value": 1,
"description": "tf(termFreq(tags:italian)=1)"
},
{
"value": 5.6289353,
"description": "idf(docFreq=399, maxDocs=40962)"
},
{
"value": 5,
"description": "fieldNorm(field=tags, doc=14282)"
}
]
}
]
}
]
}
},
为了让搜索和索引忽略词频,您需要执行特殊的查询类型吗?我是否不正确地使用了 omit_term_freq_and_positions ?
帮助将不胜感激!