Script Exception on Elasticsearch function score script query

Hello, I have used function score for a query and my script is:

"doc['Field1_score'].value != null && doc['Field2_score'].value !=null ? (doc['Field1_score'].value * 100000) + (doc['Field2_score'].value * 100000) : 1",

It is getting script exception in .value function, doc['Field1_score'].value as Field1_score is not present in the document. but It is present in the index mapping.

same goes for Field2_score, as some document contains Field2_score and some contains Field1_score. How to handle this situation??

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