Search in sources :

Example 1 with MultiSearchTemplateResponse

use of org.elasticsearch.script.mustache.MultiSearchTemplateResponse in project apm-agent-java by elastic.

the class AbstractEs6_4ClientInstrumentationTest method testMultisearchTemplateRequest_validateSpanContentAndDbContext.

@Test
public void testMultisearchTemplateRequest_validateSpanContentAndDbContext() throws InterruptedException, ExecutionException, IOException {
    createDocument();
    reporter.reset();
    SearchTemplateRequest searchTemplateRequest = prepareSearchTemplateRequest();
    MultiSearchTemplateRequest multiRequest = new MultiSearchTemplateRequest();
    multiRequest.add(searchTemplateRequest);
    MultiSearchTemplateResponse response = doMultiSearchTemplate(multiRequest);
    MultiSearchTemplateResponse.Item[] items = response.getResponses();
    assertThat(items.length).isEqualTo(1);
    verifyTotalHits(items[0].getResponse().getResponse().getHits());
    List<Span> spans = reporter.getSpans();
    assertThat(spans).hasSize(1);
    Span span = spans.get(0);
    validateSpanContent(span, String.format("Elasticsearch: POST /_msearch/template", INDEX), 200, "POST");
    verifyMultiSearchTemplateSpanContent(span);
    deleteDocument();
}
Also used : MultiSearchTemplateRequest(org.elasticsearch.script.mustache.MultiSearchTemplateRequest) SearchTemplateRequest(org.elasticsearch.script.mustache.SearchTemplateRequest) MultiSearchTemplateRequest(org.elasticsearch.script.mustache.MultiSearchTemplateRequest) MultiSearchTemplateResponse(org.elasticsearch.script.mustache.MultiSearchTemplateResponse) Span(co.elastic.apm.agent.impl.transaction.Span) AbstractEsClientInstrumentationTest(co.elastic.apm.agent.esrestclient.AbstractEsClientInstrumentationTest) Test(org.junit.Test)

Aggregations

AbstractEsClientInstrumentationTest (co.elastic.apm.agent.esrestclient.AbstractEsClientInstrumentationTest)1 Span (co.elastic.apm.agent.impl.transaction.Span)1 MultiSearchTemplateRequest (org.elasticsearch.script.mustache.MultiSearchTemplateRequest)1 MultiSearchTemplateResponse (org.elasticsearch.script.mustache.MultiSearchTemplateResponse)1 SearchTemplateRequest (org.elasticsearch.script.mustache.SearchTemplateRequest)1 Test (org.junit.Test)1