The documents in my index have a field containing a list of all attribute terms, like
"fieldA": ["attr1", "attr3", "attr7"]
and for each attribute term, a field containing its weight, like
"weight:attr1": 0.5, "weight:attr3": 0.3, "weight:attr7": 0.8].
I am using a
multi_match query on the
"fieldA" right now and I want to incorporate these weights into the score, so that the score of any query, document pair can be
doc["weight:attr1"] * tf-idf(query, doc, "attr1") + doc["weight:attr2"] * tf-idf(query, doc, "attr2") + ....
I am wondering how I should construct this query.
I tried using
function_score but since
function_score is per query I have to explicitly list out all possible
"attr"s at query time which is not ideal for me.