Class RatedRequest

java.lang.Object
org.opensearch.index.rankeval.RatedRequest
All Implemented Interfaces:
Writeable, ToXContent, ToXContentObject

public class RatedRequest extends Object implements Writeable, ToXContentObject
Definition of a particular query in the ranking evaluation request.
This usually represents a single user search intent and consists of an id (ideally human readable and referencing the search intent), the list of indices to be queries and the SearchSourceBuilder that will be used to create the search request for this search intent.
Alternatively, a template id and template parameters can be provided instead.
Finally, a list of rated documents for this query also needs to be provided.

The json structure in the rest request looks like this:

 {
    "id": "coffee_query",
    "request": {
        "query": {
            "match": { "beverage": "coffee" }
        }
    },
    "summary_fields": ["title"],
    "ratings": [
        {"_index": "my_index", "_id": "doc1", "rating": 0},
        {"_index": "my_index", "_id": "doc2","rating": 3},
        {"_index": "my_index", "_id": "doc3", "rating": 1}
    ]
 }
 
  • Constructor Details

    • RatedRequest

      public RatedRequest(String id, List<RatedDocument> ratedDocs, Map<String,Object> params, String templateId)
      Create a rated request with template ids and parameters.
      Parameters:
      id - a unique name for this rated request
      ratedDocs - a list of document ratings
      params - template parameters
      templateId - a templare id
    • RatedRequest

      public RatedRequest(String id, List<RatedDocument> ratedDocs, SearchSourceBuilder evaluatedQuery)
      Create a rated request using a SearchSourceBuilder to define the evaluated query.
      Parameters:
      id - a unique name for this rated request
      ratedDocs - a list of document ratings
      evaluatedQuery - the query that is evaluated
  • Method Details