Search elements inside nested fields

Hi,

I have field which stores an array of objects. Each object contains a key on the basis of which we need to perform search operation and get the list of the matched terms only. We have achieved this using a combination of Nested and Filter Aggregation.

But we are unable to sort the results on the basis of their "matching score".

Is there a way we can achieve this?

Here's the query we are using:-

    {
   "size": 0,
    "aggs": {
        "concepts": {
            "nested": {
                "path": "nestedField"
            },
            "aggs": {
                "concepts": {
                    "filter": {
                        "match": {
                            "nestedField.key": "Search Term"
                        }
                    },
                    "aggs": {
                        "concepts": {
                            "terms": {
                                "field": "nestedField.key",
                                "size": 1000
                            }
                        }
                    }
                }
            }
        }
    }
    }