您无法获得结果的主要原因是因为您试图对进行term
过滤actionType
,这是一个已分析的字段。如果要term
对该字段进行匹配,则需要更新类型映射以将该字段设置为not_analyzed
。请参见以下示例映射:
{
"record": {
"properties": {
"actionType": {
"type": "string",
"index": "not_analyzed",
},
"loId": {
"type": "long"
},
"paId": {
"type": "long"
},
"prId": {
"type": "long"
},
"timestamp": {
"type": "long"
},
"uid": {
"type": "long"
},
"vId": {
"type": "long"
}
}
}
}
从此处开始阅读有关映射的信息:http ://www.elasticsearch.org/guide/reference/mapping/。您需要重新索引数据。修复该问题后,下面的查询将起作用:
{
"query": {
"filtered": {
"query": {"match_all":{}},
"filter": {
"bool": {
"must": [
{"term": {"loId":6}},
{
"or": [
{"term":{"actionType": "SAVE_DATA"}},
{"term":{"actionType": "OPEN_SCREEN"}}
]
}
]
}
}
}
}
}