Elasticsearch find which field and array index matched?

I am currently using multi_match to search nested datatypes.

I want to find the index of shortreview which matched my query.
For example, if query matched """ review_ccc """ of my review field, return 2.

my purpose is to find reviewId of shortreview or review. Because reviewId will be placed in the same order with shortreview and review, I need to find the index of the match.

GET recpost_test/_search
{
  "from": 0,
  "size": 2,
  "query":{
    "multi_match": {
      "query" : "This is what I want to find!",
      "analyzer": "my_analyzer", 
      "type": "best_fields", 
      "fields" : [
        "itemname",
        "review",
        "shortreview^2"]
        
    }
  }
}

Here's the simplified version of query result

{
  "took" : 12,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 58,
      "relation" : "eq"
    },
    "max_score" : 19.384338,
    "hits" : [
      {
        "_index" : "recpost_test",
        "_type" : "_doc",
        "_id" : "202",
        "_score" : 19.384338,
        "_source" : {
          "reviewId" : [
            "1",
            "2",
            "3"
          ],
          "review" : [
            """ review_aaa """,
            """ review_bbb """,
            """ review_ccc """
          ],
          "shortreview" : [
            """ shortreview_aaa """,
            """ shortreview_bbb """,
            """ shortreview_ccc """
          ],
          "itemname" : [
            "item_a",
            "item_b",
            "item_c"
          ]
        }
      }
    ]
  }
}

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