Package org.opensearch.index.rankeval
Class RatedRequest
java.lang.Object
org.opensearch.index.rankeval.RatedRequest
- All Implemented Interfaces:
Writeable,org.opensearch.core.xcontent.ToXContent,org.opensearch.core.xcontent.ToXContentObject
public class RatedRequest
extends Object
implements Writeable, org.opensearch.core.xcontent.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
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.
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}
]
}
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.common.io.stream.Writeable
Writeable.Reader<V extends Object>, Writeable.WriteableRegistry, Writeable.Writer<V extends Object> -
Field Summary
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionRatedRequest(String id, List<RatedDocument> ratedDocs, Map<String, Object> params, String templateId) Create a rated request with template ids and parameters.RatedRequest(String id, List<RatedDocument> ratedDocs, SearchSourceBuilder evaluatedQuery) Create a rated request using aSearchSourceBuilderto define the evaluated query. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSummaryFields(List<String> summaryFields) final booleanstatic RatedRequestfromXContent(org.opensearch.core.xcontent.XContentParser parser) parse from rest representationgetId()return the user supplied request idreturn the parameters if this request uses a template, otherwise this will be empty.return the list of rated documents to evaluate.returns a list of fields that should be included in the document summary for matched documentsreturn the parameters if this request uses a template, otherwise this will benull.final inthashCode()toString()org.opensearch.core.xcontent.XContentBuildertoXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) voidwriteTo(StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentObject
isFragment
-
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 requestratedDocs- a list of document ratingsparams- template parameterstemplateId- a templare id
-
RatedRequest
Create a rated request using aSearchSourceBuilderto define the evaluated query.- Parameters:
id- a unique name for this rated requestratedDocs- a list of document ratingsevaluatedQuery- the query that is evaluated
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
getEvaluationRequest
-
getId
return the user supplied request id -
getRatedDocs
return the list of rated documents to evaluate. -
getParams
return the parameters if this request uses a template, otherwise this will be empty. -
getTemplateId
return the parameters if this request uses a template, otherwise this will benull. -
getSummaryFields
returns a list of fields that should be included in the document summary for matched documents -
addSummaryFields
-
fromXContent
parse from rest representation -
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.opensearch.core.xcontent.ToXContent- Throws:
IOException
-
toString
-
equals
-
hashCode
public final int hashCode()
-