Scoring based on percentage of category

I'm not quite sure where to get started with this query. I'm using the opensearch quickstart data to try to explain. The documents have the following fields for example:

{
          ...
          "customer_first_name": "Sonya",
          "customer_full_name": "Sonya Foster",
          "customer_last_name": "Foster",
          ...
}

I'm applying a simple filter like this:

{
     "query": {
         "match": {
             "customer_first_name": "Sonya"
         }
     }
 }

The part where I'm not sure what to do is how to score the results after the filtering is done. The scoring includes aggregation and a calculation of coverage of a category. For example, if we have documents where the customer_first_name = "Sonya" and all of the last names returned are:

"Foster", "Johnson", "Lincoln", "Wells"

The user would like to pass in the selections:

"Foster", "Lincoln"

And the scoring function would calculate that the score for customer_first_name "Sonya" = 50% because they passed in half of the values.

I appreciate it if any of you could point me in the right direction. I just don't see how to approach it yet. Thanks,

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

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