TermsQuery sine ES6.0 - with scoring


(Jean Seiler) #1

Hi,
I would like to ask for help about a behavior change between 5.6 and 6.0 ES version

With ES 5.6, when I use a TermsQuery (without constant_score) a score is computed
Since 6.0 the score is not computed (even without constant_score)
Since 6.0 ES termsquery is transformed to Lucene TermInSetQuery

Query sample:

GET /myindex/_search
{
"query" : {
"terms" : {
"MYFIELD" : {["val1","val2","val3"]
}
}
}
}

Is there a way to still use a TermsQuery with score computation ??? or have I to write my own TermsQueryBuilder??
Any suggestions.???.. In advance Thanks


(Mark Harwood) #2

You have to use a bool query with an array of should clauses - each being a term (singular) query.


(Jean Seiler) #3

Thanks,

indeed for my previous sample it's not heavy to use a bool query but my real usecase is with a TermsLookup

 GET /myindex/_search
 {
 	"query" : {
       "terms" : {
         "MYFIELD" : {
           "index": "memory", "type" : "memory",
           "path" : "words", "id" : "1"
         }
       }
 	}
 }

The values are store inside a document of memory index


(system) #4

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