use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class MessagesAdapterES7 method createBulkRequest.
private BulkRequest createBulkRequest(List<IndexingRequest> chunk) {
final BulkRequest bulkRequest = new BulkRequest();
chunk.forEach(request -> bulkRequest.add(indexRequestFrom(request)));
return bulkRequest;
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class PlainJsonApi method perform.
public JsonNode perform(Request request, String errorMessage) {
return client.execute((c, requestOptions) -> {
request.setOptions(requestOptions);
final Response response = c.getLowLevelClient().performRequest(request);
return objectMapper.readTree(response.getEntity().getContent());
}, errorMessage);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class IndicesAdapterES7 method close.
@Override
public void close(String index) {
final CloseIndexRequest request = new CloseIndexRequest(index);
client.execute((c, requestOptions) -> c.indices().close(request, requestOptions), "Unable to close index " + index);
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ElasticsearchBackendSearchTypesWithStreamsOverridesTest method searchTypeWithEmptyStreamsDefaultsToQueriesStreams.
@Test
public void searchTypeWithEmptyStreamsDefaultsToQueriesStreams() throws IOException {
final Query query = queryFor(Pivot.builder().id("pivot1").series(Collections.singletonList(Average.builder().field("field1").build())).rollup(true).streams(Collections.emptySet()).build());
final List<SearchRequest> request = run(query);
assertThat(indicesOf(request).get(0)).isEqualTo("index1,index2");
}
use of org.graylog.shaded.elasticsearch7.org.elasticsearch.client.Request in project graylog2-server by Graylog2.
the class ElasticsearchBackendSearchTypesWithStreamsOverridesTest method searchTypeWithStreamsOverridesQueriesStreams.
@Test
public void searchTypeWithStreamsOverridesQueriesStreams() throws IOException {
final Query query = queryFor(Pivot.builder().id("pivot1").series(Collections.singletonList(Average.builder().field("field1").build())).rollup(true).streams(Collections.singleton(stream2Id)).build());
final List<SearchRequest> request = run(query);
assertThat(indicesOf(request).get(0)).isEqualTo("index3");
}
Aggregations