org.elasticsearch.action.explain.ExplainRequest Java Examples

The following examples show how to use org.elasticsearch.action.explain.ExplainRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExplainRequestBuilder.java    From elasticshell with Apache License 2.0 6 votes vote down vote up
@Override
protected XContentBuilder toXContent(ExplainRequest request, ExplainResponse response, XContentBuilder builder) throws IOException {
    builder.startObject();
    builder.field(Fields.OK, response.isExists())
            .field(Fields._INDEX, request.index())
            .field(Fields._TYPE, request.type())
            .field(Fields._ID, request.id())
            .field(Fields.MATCHED, response.isMatch());

    if (response.hasExplanation()) {
        builder.startObject(Fields.EXPLANATION);
        buildExplanation(builder, response.getExplanation());
        builder.endObject();
    }
    GetResult getResult = response.getGetResult();
    if (getResult != null) {
        builder.startObject(Fields.GET);
        getResult.toXContentEmbedded(builder, ToXContent.EMPTY_PARAMS);
        builder.endObject();
    }
    builder.endObject();
    return builder;
}
 
Example #2
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<ExplainResponse> explain(ExplainRequest request) {
    return execute(ExplainAction.INSTANCE, request);
}
 
Example #3
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void explain(ExplainRequest request, ActionListener<ExplainResponse> listener) {
    execute(ExplainAction.INSTANCE, request, listener);
}
 
Example #4
Source File: ClientWithStats.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public ActionFuture<ExplainResponse> explain(ExplainRequest request) {
	return wrapped.explain(request);
}
 
Example #5
Source File: ClientWithStats.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void explain(ExplainRequest request, ActionListener<ExplainResponse> listener) {
	wrapped.explain(request, listener);
}
 
Example #6
Source File: ReactorElasticSearchClient.java    From james-project with Apache License 2.0 4 votes vote down vote up
public Mono<ExplainResponse> explain(ExplainRequest explainRequest, RequestOptions options) {
    return toReactor(listener -> client.explainAsync(explainRequest, options, listener));
}
 
Example #7
Source File: FessEsClient.java    From fess with Apache License 2.0 4 votes vote down vote up
@Override
public ActionFuture<ExplainResponse> explain(final ExplainRequest request) {
    return client.explain(request);
}
 
Example #8
Source File: FessEsClient.java    From fess with Apache License 2.0 4 votes vote down vote up
@Override
public void explain(final ExplainRequest request, final ActionListener<ExplainResponse> listener) {
    client.explain(request, listener);
}
 
Example #9
Source File: ExplainRequestBuilder.java    From elasticshell with Apache License 2.0 4 votes vote down vote up
public ExplainRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
    super(client, new ExplainRequest(null, null, null), jsonToString, stringToJson);
}
 
Example #10
Source File: ExplainRequestBuilder.java    From elasticshell with Apache License 2.0 4 votes vote down vote up
@Override
protected ActionFuture<ExplainResponse> doExecute(ExplainRequest request) {
    return client.explain(request);
}
 
Example #11
Source File: Client.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Computes a score explanation for the specified request.
 *
 * @param request The request encapsulating the query and document identifier to compute a score explanation for
 */
ActionFuture<ExplainResponse> explain(ExplainRequest request);
 
Example #12
Source File: Client.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Computes a score explanation for the specified request.
 *
 * @param request  The request encapsulating the query and document identifier to compute a score explanation for
 * @param listener A listener to be notified of the result
 */
void explain(ExplainRequest request, ActionListener<ExplainResponse> listener);