用下面的查询速度很快, 实际由于filter条件限制多, 查出来的数据量确实也不多
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term":{"type1":"aaa"}},
{"term":{"type2":"bbb"}},
{"term":{"type3":"ccc"}}
]
}
}
}
},
"size": 100
但是一旦加上query部分wildcard后就非常慢. 有没有什么办法是在filter基础上再做query的查询吗?
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term":{"type1":"aaa"}},
{"term":{"type2":"bbb"}},
{"term":{"type3":"ccc"}}
]
}
},
"query": {
"bool": {
"should": [
{"wildcard": {"name1": "*ddd*"}},
{"wildcard": {"name1": "*eee*"}}
]
}
}
}
},
"size": 100
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term":{"type1":"aaa"}},
{"term":{"type2":"bbb"}},
{"term":{"type3":"ccc"}}
]
}
}
}
},
"size": 100
但是一旦加上query部分wildcard后就非常慢. 有没有什么办法是在filter基础上再做query的查询吗?
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"term":{"type1":"aaa"}},
{"term":{"type2":"bbb"}},
{"term":{"type3":"ccc"}}
]
}
},
"query": {
"bool": {
"should": [
{"wildcard": {"name1": "*ddd*"}},
{"wildcard": {"name1": "*eee*"}}
]
}
}
}
},
"size": 100
1 个回复
yangruideyang
赞同来自: