SpanOrQuery Problem

I have a field (navigation.path) using whitespace analyzer to analyze.

When the value is "P1 P2 P3 P4 P5",
I hope the query which has the meaning similar to P1 (slop 5) (P2 or P4) (slop 0) P5 can match it. It failed.
I use P1 (slop 5) P4 (slop 0) P5, and it matched.

Here is my confuse. When using the spanOrQuery, is elasticsearch just match one condition and continue to match remaining query, and will not go back to match other span or conditions even the previous match failed?
If it is true, is the spanOrQuery can only be the last item in span queries?

Below is my query dsl.
{
"span_near" : {
"clauses" : [ {
"span_near" : {
"clauses" : [ {
"span_or" : {
"clauses" : [ {
"span_term" : {
"navigation.path" : {
"value" : "P1"
}
}
} ]
}
}, {
"span_first" : {
"match" : {
"span_or" : {
"clauses" : [ {
"span_term" : {
"navigation.path" : {
"value" : "P4"
}
}
}, {
"span_term" : {
"navigation.path" : {
"value" : "P2"
}
}
} ]
}
},
"end" : 10
}
} ],
"slop" : 5,
"in_order" : true
}
}, {
"span_or" : {
"clauses" : [ {
"span_term" : {
"navigation.path" : {
"value" : "P5"
}
}
} ]
}
} ],
"slop" : 0,
"in_order" : true
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.