我希望以这样的方式使用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吗?
非常感谢帮助!