我有一个elasticsearch查询:
"query": {
"bool": {
"minimum_should_match": 1,
"should": {
"span_not": {
"exclude": {
"span_or": {
"clauses": [{
"span_near": {
...
},
"span_near": {
...
}
}]
}
}...
我需要在include子句中添加以下内容:
"span_or": {
clauses: [
{
"span_near": {...}
}
,
{
"span_and": {
"clases": [
{
"span_near": {...}
}
,
{
"span_near": {...}
}
,
...
]
}
}
]
}
我的意思是,我有“或”查询:
(span_near or span_near or span_near or ...)
我想得到“和”查询:
(span_near or (span_near and span_near) or ...)
我该怎么做?没有标签“span_and”。我可以改用什么标签?
更新1
我已经试过了:
"span_or": {
clauses: [
{
"span_multi": {
"match": {
"regexp": {
"message": "путин.*"
}
}
}
}
,
{
"span_multi": {
"match": {
"bool": {
"must": [
{
"term" : { "message" : "test" }
},
{
"term" : { "message" : "rrr" }
}
]
}
}
}
}
]
}
但我有一个错误:
spanMultiTerm [match] must be of type multi term query
最佳答案
普通的bool
查询可以解决您的问题吗?
{
"query": {
"bool": {
"must_not": {
"bool": {
"should": [
{
"regexp":{
"message": "путин.*"
}
},
{
"bool": {
"must": [
{
"span_near": {...}
},
{
"span_near": {...}
}
]
}
}
]
}
}
}
}
}
关于json - Elasticsearch “span and”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36908850/