我有一个查询像下面,Elasticsearch搜索查询只返回精确匹配
任何想法,为什么我只得到确切的比赛结果时,我做搜索。例如 ;
当我搜索“的Aegli”我得到的结果,但是当我搜索“Aegl”未返回任何结果
query = {
"query": {
"query_string": {
"query": "%s"%q
}
},
"filter": {
"term": {
"has_product": 1
}
},
"facets": {
"destination": {
"terms": {
"field": "destination.en"
},
"facet_filter": {
"term": {
"has_product": 1
}
}
},
"hotel_class": {
"terms": {
"field": "hotel_class"
},
"facet_filter": {
"term": {
"has_product": 1
}
}
},
"hotel_type": {
"terms": {
"field": "hotel_type"
},
"facet_filter": {
"term": {
"has_product": 1
}
}
}
}
}
这就像Lucene的倒排索引应该工作的方式。您可以决定索引ngrams(但索引将快速增长)或使用通配符查询(较慢)。 – javanna