I think I've figured out how to search for a particular user query using span, except I'd like to run an OR query for the stemmed and non-stemmed version of the field.
The query I'm trying to satisfy is: phraseWord1 phraseWord2 /50 (word1 OR word2).
So, I can search the non-stemmed (or stemmed) field doing this:
{
"span_near" : {
"clauses" : [
{
"span_near" : {
"clauses" : [
{ "span_term" : { "field" : "phraseWord1" } },
{ "span_term" : { "field" : "phraseWord2" } }
],
"slop" : 0,
"in_order" : true
}
},
{
"span_or" : {
"clauses" : [
{ "span_term" : { "field" : "word1" } },
{ "span_term" : { "field" : "word2" } }
]
}
}
],
"slop" : 50,
"in_order" : false
}
}
However, I can't figure out how to OR this with the exact same span query for "field.stemmed" instead of "field". I tried to use "span_or" for this, but apparently it wouldn't let me combine the two queries (one in "field" and the other in "field.stemmed") because I get an error saying that:
"caused_by": {
"type": "illegal_argument_exception",
"reason": "Clauses must have same field."
Thanks for any direction, I'd appreciate it... Still learning...
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.