我能够为以下弹性的搜索查询得到的数据:弹性搜索:匹配查询没有嵌套布尔工作滤清器
{
"query": {
"filtered": {
"query": [],
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"term": {
"gender": "malE"
}
},
{
"term": {
"sentiment": "positive"
}
}
]
}
}
]
}
}
}
}
}
但是,如果我查询中使用“匹配” - 我得到400错误信息状态响应
{
"query": {
"filtered": {
"query": [],
"filter": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"match": {
"gender": "malE"
}
},
{
"term": {
"sentiment": "positive"
}
}
]
}
}
]
}
}
}
}
}
匹配查询在嵌套bool过滤器中不受支持吗?
由于术语查询在字段的倒排索引中查找确切的术语,我想查询性别数据作为case_insensitive字段 - 我应该尝试哪种方法?
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"analyzer_keyword": {
"tokenizer": "keyword",
"filter": "lowercase"
}
}
}
}
}
}
的映射场性别:指数
设置
{"type":"string","analyzer":"analyzer_keyword"}
更容易 –
@johnSmith我没有得到你。你的意思是我应该搜索使属性小写,然后通过术语查询进行搜索? –
我的意思是你最有可能的索引对象,并有一个elasticsearch的映射,你可以简单地添加一个属性和一个getter函数到你的对象类,返回小写的名字,将这个字段添加到弹性映射,你没有问题 –