【发布时间】:2019-12-11 20:46:39
【问题描述】:
我在弹性搜索中有一个名为 category 的字段,它包含多个值。以下是样本值
"category": [
"Commercial",
"CafeBarRestaurant",
"Tables"
],
现在我正在查询弹性搜索以获取类别为“商业”的文档。以下是我的查询:
{
"from":0,
"size":40,
"query":{
"bool":{
"filter":[
{
"bool":{
"must":[
{
"term":{
"category":{
"value":"Commercial",
"boost":1.0
}
}
}
],
"adjust_pure_negative":true,
"boost":1.0
}
}
],
"adjust_pure_negative":true,
"boost":1.0
}
} } 映射:
{
"products": {
"mappings": {
"category": {
"full_name": "category",
"mapping": {
"category": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
每次它都给我空的结果。任何人都可以向我建议查询中有什么问题。 谢谢。
【问题讨论】:
-
您的查询Commerical is not Commercial
-
添加票证的请求中的错字。使用匹配值,结果为零
-
从这里通过示例更改您的查询elastic.co/guide/en/elasticsearch/reference/current/… 我的问题在于 bool 过滤器和 bool 必须序列
标签: elasticsearch