How to get score based on the matched field value in multi match (cross_fields)

Hi !
I'm looking for the way to get score based on the matched field value in the query of cross field in multi match.

This is how one of my index field looks like,

    "field_with_value" : [
                {
                  "name" : "Liam",
                  "value" : 15
                },
                {
                  "name" : "Jake",
                  "value" : 19
                },
                {
                  "name" : "Pall",
                  "value": 7
                }
              ],

And this is how my simplified version of the query looks like,

    {
      "query": {
        "script_score": {
          "query": {
            "bool": {
              "must": [
                {
                  "multi_match": {
                    "query": "Kind Liam",
                    "type": "cross_fields",
                    "fields": [
                      "field_A.name",
                      "field_B.name",
                      "field_with_value.name"
                    ],
                    "operator": "and"
                  }
                }
              ],
              "filter": [...]
            }
          },
          "script": {...}
        }
      }
    }

When field_with_value matched, how can I get the score using the 'value' of the matched field_with_value of the document?

Thanks for reading it!
I'll be waiting for your help :smiley:

For those who need it later,
I solved it from here [Stackoverflow]

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