[英]ElasticSearch filtered query and filter term
I'm trying to use a filter
on a filtered
query, this is what I'm trying with Sense: 我正在尝试对filtered
查询使用filter
,这就是我正在尝试的Sense:
GET myindex/catalog/_search
{
"query": {
"filtered": {
"query": {
"query_string": {
"analyze_wildcard": true,
"query": "test",
"fields": ["title^3.5", "contributions.authors.name^5", "publisher^2", "formats.productCode^0.5", "description^0.1"],
"use_dis_max": true
}
},
"filter": {
"term": {
"sku": "test-687"
}
}
}
}
}
This query hasn't any hit, but if I remove the filter
property I get exactly the item with sku = test-687
. 该查询没有任何结果,但是如果我删除filter
属性,则可以得到sku = test-687
。
I cannot understand why the query with the filter
doesn't give me the same result. 我不明白为什么带有filter
的查询不能给我相同的结果。
Mapping: 对应:
{
"myindex": {
"mappings": {
"catalog": {
"properties": {
"sku": {
"type": "string"
},
"title": {
"type": "string"
},
"updated_at": {
"type": "date",
"format": "strict_date_optional_time||epoch_millis"
}
}
}
}
}
}
the full query is: 完整的查询是:
GET myindex/catalog/_search {
"query": {
"filtered": {
"query": {
"query_string": {
"analyze_wildcard": true,
"query": "test",
"fields": ["title^3.5", "contributions.authors.name^5", "publisher^2", "formats.productCode^0.5", "description^0.1"],
"use_dis_max": true
}
},
"filter": {
"bool": {
"must": {
"query": {
"match": {
"sku": "test-687"
}
}
}
}
}
}
}
}
With default mapping the "Standard Analyser is used" : 在默认映射下,“使用标准分析仪”:
An analyzer of type standard is built using the Standard Tokenizer with the Standard Token Filter, Lower Case Token Filter, and Stop Token Filter. 使用带有标准令牌过滤器,小写令牌过滤器和停止令牌过滤器的标准令牌生成器构建标准类型的分析器。
Term is case sensitive, match not 术语区分大小写,不匹配
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.