【发布时间】:2016-04-01 18:01:08
【问题描述】:
我正在尝试对 _all 字段执行通配符查询。一个示例查询可能是:
GET index/type/_search
{
"from" : 0,
"size" : 1000,
"query" : {
"bool" : {
"must" : {
"wildcard" : {
"_all" : "*tito*"
}
}
}
}
}
问题是要使用通配符查询,_all 字段需要不_分析,否则查询将不起作用。请参阅ES documentation 了解更多信息。
我尝试使用此请求设置mappings over the _all field:
PUT index
{
"mappings": {
"type": {
"_all" : {
"enabled" : true,
"index_analyzer": "not_analyzed",
"search_analyzer": "not_analyzed"
},
"_timestamp": {
"enabled": "true"
},
"properties": {
"someProp": {
"type": "date"
}
}
}
}
}
但我收到错误analyzer [not_analyzed] not found for field [_all]。
我想知道我做错了什么以及是否有另一种(更好的)方法来执行这种查询。
谢谢。-
【问题讨论】:
标签: elasticsearch