You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/06/05 10:09:29 UTC

[james-project] 02/08: JAMES-2767 Downgrading backend ES to 6.3.2 client

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit c5463f51f11874b9bc9dd982d8bea806a510e74b
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Tue Jun 4 13:38:36 2019 +0700

    JAMES-2767 Downgrading backend ES to 6.3.2 client
---
 backends-common/elasticsearch/pom.xml              |  2 +-
 .../james/backends/es/DeleteByQueryPerformer.java  | 84 ++++++++++++++++++++++
 .../james/backends/es/ElasticSearchIndexer.java    | 23 ++----
 .../james/backends/es/IndexCreationFactory.java    | 12 ++--
 .../james/backends/es/NodeMappingFactory.java      | 29 ++++----
 .../james/backends/es/search/ScrollIterable.java   |  6 +-
 .../es/ClientProviderImplConnectionTest.java       |  4 +-
 .../backends/es/ElasticSearchIndexerTest.java      | 25 +++----
 .../backends/es/search/ScrollIterableTest.java     | 21 ++----
 9 files changed, 128 insertions(+), 78 deletions(-)

diff --git a/backends-common/elasticsearch/pom.xml b/backends-common/elasticsearch/pom.xml
index d5f5847..34c99af 100644
--- a/backends-common/elasticsearch/pom.xml
+++ b/backends-common/elasticsearch/pom.xml
@@ -82,7 +82,7 @@
         <dependency>
             <groupId>org.elasticsearch.client</groupId>
             <artifactId>elasticsearch-rest-high-level-client</artifactId>
-            <version>6.7.2</version>
+            <version>6.3.2</version>
         </dependency>
         <dependency>
             <groupId>org.slf4j</groupId>
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
new file mode 100644
index 0000000..c84c9fc
--- /dev/null
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/DeleteByQueryPerformer.java
@@ -0,0 +1,84 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+package org.apache.james.backends.es;
+
+import org.apache.james.backends.es.search.ScrollIterable;
+import org.elasticsearch.action.bulk.BulkRequest;
+import org.elasticsearch.action.bulk.BulkResponse;
+import org.elasticsearch.action.delete.DeleteRequest;
+import org.elasticsearch.action.search.SearchRequest;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.client.RestHighLevelClient;
+import org.elasticsearch.common.unit.TimeValue;
+import org.elasticsearch.index.query.QueryBuilder;
+import org.elasticsearch.search.SearchHit;
+import org.elasticsearch.search.builder.SearchSourceBuilder;
+
+import com.google.common.annotations.VisibleForTesting;
+
+import reactor.core.publisher.Flux;
+import reactor.core.publisher.Mono;
+
+public class DeleteByQueryPerformer {
+    private static final TimeValue TIMEOUT = new TimeValue(60000);
+
+    private final RestHighLevelClient client;
+    private final int batchSize;
+    private final WriteAliasName aliasName;
+
+    @VisibleForTesting
+    public DeleteByQueryPerformer(RestHighLevelClient client, int batchSize, WriteAliasName aliasName) {
+        this.client = client;
+        this.batchSize = batchSize;
+        this.aliasName = aliasName;
+    }
+
+    public Mono<Void> perform(QueryBuilder queryBuilder) {
+        return Flux.fromStream(new ScrollIterable(client, prepareSearch(queryBuilder)).stream())
+            .flatMap(searchResponse -> deleteRetrievedIds(client, searchResponse))
+            .thenEmpty(Mono.empty());
+    }
+
+    private SearchRequest prepareSearch(QueryBuilder queryBuilder) {
+        return new SearchRequest(aliasName.getValue())
+            .types(NodeMappingFactory.DEFAULT_MAPPING_NAME)
+            .scroll(TIMEOUT)
+            .source(searchSourceBuilder(queryBuilder));
+    }
+
+    private SearchSourceBuilder searchSourceBuilder(QueryBuilder queryBuilder) {
+        return new SearchSourceBuilder()
+            .query(queryBuilder)
+            .size(batchSize);
+    }
+
+    private Mono<BulkResponse> deleteRetrievedIds(RestHighLevelClient client, SearchResponse searchResponse) {
+        BulkRequest request = new BulkRequest();
+
+        for (SearchHit hit : searchResponse.getHits()) {
+            request.add(
+                new DeleteRequest(aliasName.getValue())
+                    .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
+                    .id(hit.getId()));
+        }
+
+        return Mono.fromCallable(() -> client.bulk(request));
+    }
+}
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchIndexer.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchIndexer.java
index 0231e09..1006232 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchIndexer.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchIndexer.java
@@ -29,13 +29,10 @@ import org.elasticsearch.action.delete.DeleteRequest;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.index.IndexResponse;
 import org.elasticsearch.action.update.UpdateRequest;
-import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.common.ValidationException;
-import org.elasticsearch.common.unit.TimeValue;
 import org.elasticsearch.common.xcontent.XContentType;
 import org.elasticsearch.index.query.QueryBuilder;
-import org.elasticsearch.index.reindex.DeleteByQueryRequest;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -45,13 +42,12 @@ import com.google.common.base.Preconditions;
 public class ElasticSearchIndexer {
     private static final int DEBUG_MAX_LENGTH_CONTENT = 1000;
     private static final int DEFAULT_BATCH_SIZE = 100;
-    private static final TimeValue TIMEOUT = TimeValue.timeValueMinutes(1);
 
     private static final Logger LOGGER = LoggerFactory.getLogger(ElasticSearchIndexer.class);
 
     private final RestHighLevelClient client;
     private final AliasName aliasName;
-    private final int batchSize;
+    private final DeleteByQueryPerformer deleteByQueryPerformer;
 
     public ElasticSearchIndexer(RestHighLevelClient client,
                                 WriteAliasName aliasName) {
@@ -63,8 +59,8 @@ public class ElasticSearchIndexer {
                                 WriteAliasName aliasName,
                                 int batchSize) {
         this.client = client;
+        this.deleteByQueryPerformer = new DeleteByQueryPerformer(client, batchSize, aliasName);
         this.aliasName = aliasName;
-        this.batchSize = batchSize;
     }
 
     public IndexResponse index(String id, String content) throws IOException {
@@ -76,8 +72,7 @@ public class ElasticSearchIndexer {
             new IndexRequest(aliasName.getValue())
                 .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                 .id(id)
-                .source(content, XContentType.JSON),
-            RequestOptions.DEFAULT);
+                .source(content, XContentType.JSON));
     }
 
     public Optional<BulkResponse> update(List<UpdatedRepresentation> updatedDocumentParts) throws IOException {
@@ -89,7 +84,7 @@ public class ElasticSearchIndexer {
                     NodeMappingFactory.DEFAULT_MAPPING_NAME,
                     updatedDocumentPart.getId())
                 .doc(updatedDocumentPart.getUpdatedDocumentPart(), XContentType.JSON)));
-            return Optional.of(client.bulk(request, RequestOptions.DEFAULT));
+            return Optional.of(client.bulk(request));
         } catch (ValidationException e) {
             LOGGER.warn("Error while updating index", e);
             return Optional.empty();
@@ -103,7 +98,7 @@ public class ElasticSearchIndexer {
                 new DeleteRequest(aliasName.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id)));
-            return Optional.of(client.bulk(request, RequestOptions.DEFAULT));
+            return Optional.of(client.bulk(request));
         } catch (ValidationException e) {
             LOGGER.warn("Error while deleting index", e);
             return Optional.empty();
@@ -111,13 +106,7 @@ public class ElasticSearchIndexer {
     }
 
     public void deleteAllMatchingQuery(QueryBuilder queryBuilder) {
-        DeleteByQueryRequest request = new DeleteByQueryRequest(aliasName.getValue())
-            .setDocTypes(NodeMappingFactory.DEFAULT_MAPPING_NAME)
-            .setScroll(TIMEOUT)
-            .setQuery(queryBuilder)
-            .setBatchSize(batchSize);
-
-        client.deleteByQueryAsync(request, RequestOptions.DEFAULT, new ListenerToFuture<>());
+        deleteByQueryPerformer.perform(queryBuilder).block();
     }
 
     private void checkArgument(String content) {
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
index 993bfef..9096fb8 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/IndexCreationFactory.java
@@ -29,9 +29,8 @@ import javax.inject.Inject;
 import org.elasticsearch.ElasticsearchStatusException;
 import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
 import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
-import org.elasticsearch.client.RequestOptions;
+import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
 import org.elasticsearch.client.RestHighLevelClient;
-import org.elasticsearch.client.indices.CreateIndexRequest;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -98,15 +97,13 @@ public class IndexCreationFactory {
                         new IndicesAliasesRequest().addAliasAction(
                             new AliasActions(AliasActions.Type.ADD)
                                 .index(indexName.getValue())
-                                .alias(aliasName.getValue())),
-                        RequestOptions.DEFAULT);
+                                .alias(aliasName.getValue())));
             }
         }
 
         private boolean aliasExist(RestHighLevelClient client, AliasName aliasName) throws IOException {
             return client.indices()
-                .existsAlias(new GetAliasesRequest().aliases(aliasName.getValue()),
-                    RequestOptions.DEFAULT);
+                .existsAlias(new GetAliasesRequest().aliases(aliasName.getValue()));
         }
 
         private void createIndexIfNeeded(RestHighLevelClient client, IndexName indexName, XContentBuilder settings) throws IOException {
@@ -114,8 +111,7 @@ public class IndexCreationFactory {
                 client.indices()
                     .create(
                         new CreateIndexRequest(indexName.getValue())
-                            .source(settings),
-                        RequestOptions.DEFAULT);
+                            .source(settings));
             } catch (ElasticsearchStatusException exception) {
                 if (exception.getMessage().contains(INDEX_ALREADY_EXISTS_EXCEPTION_MESSAGE)) {
                     LOGGER.info("Index [{}] already exist", indexName);
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/NodeMappingFactory.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/NodeMappingFactory.java
index c7d0f82..880d9ad 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/NodeMappingFactory.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/NodeMappingFactory.java
@@ -21,11 +21,10 @@ package org.apache.james.backends.es;
 
 import java.io.IOException;
 
-import org.apache.james.util.streams.Iterators;
-import org.elasticsearch.client.RequestOptions;
+import org.apache.http.HttpStatus;
+import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
+import org.elasticsearch.client.ResponseException;
 import org.elasticsearch.client.RestHighLevelClient;
-import org.elasticsearch.client.indices.GetMappingsRequest;
-import org.elasticsearch.client.indices.PutMappingRequest;
 import org.elasticsearch.common.xcontent.XContentBuilder;
 
 public class NodeMappingFactory {
@@ -61,22 +60,22 @@ public class NodeMappingFactory {
     }
 
     public static boolean mappingAlreadyExist(RestHighLevelClient client, IndexName indexName) throws IOException {
-        return Iterators.toStream(client.indices()
-            .getMapping(
-                new GetMappingsRequest()
-                    .indices(indexName.getValue()),
-                RequestOptions.DEFAULT)
-            .mappings()
-            .values()
-            .iterator())
-            .anyMatch(mappingMetaData -> !mappingMetaData.getSourceAsMap().isEmpty());
+        try {
+            client.getLowLevelClient().performRequest("GET", indexName.getValue() + "/_mapping/" + NodeMappingFactory.DEFAULT_MAPPING_NAME);
+            return true;
+        } catch (ResponseException e) {
+            if (e.getResponse().getStatusLine().getStatusCode() != HttpStatus.SC_NOT_FOUND) {
+                throw e;
+            }
+        }
+        return false;
     }
 
     public static void createMapping(RestHighLevelClient client, IndexName indexName, XContentBuilder mappingsSources) throws IOException {
         client.indices().putMapping(
             new PutMappingRequest(indexName.getValue())
-                .source(mappingsSources),
-            RequestOptions.DEFAULT);
+                .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
+                .source(mappingsSources));
     }
 
 }
diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
index ad8ce22..1a8d693 100644
--- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
+++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/search/ScrollIterable.java
@@ -28,7 +28,6 @@ import org.apache.james.util.streams.Iterators;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
 import org.elasticsearch.action.search.SearchScrollRequest;
-import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.common.unit.TimeValue;
 
@@ -59,7 +58,7 @@ public class ScrollIterable implements Iterable<SearchResponse> {
         ScrollIterator(RestHighLevelClient client, SearchRequest searchRequest) {
             this.client = client;
             ListenerToFuture<SearchResponse> listener = new ListenerToFuture<>();
-            client.searchAsync(searchRequest, RequestOptions.DEFAULT, listener);
+            client.searchAsync(searchRequest, listener);
 
             this.searchResponseFuture = listener.getFuture();
         }
@@ -74,11 +73,10 @@ public class ScrollIterable implements Iterable<SearchResponse> {
         public SearchResponse next() {
             SearchResponse result = searchResponseFuture.join();
             ListenerToFuture<SearchResponse> listener = new ListenerToFuture<>();
-            client.scrollAsync(
+            client.searchScrollAsync(
                 new SearchScrollRequest()
                     .scrollId(result.getScrollId())
                     .scroll(TIMEOUT),
-                RequestOptions.DEFAULT,
                 listener);
             searchResponseFuture = listener.getFuture();
             return result;
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java
index 5072968..149aa07 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ClientProviderImplConnectionTest.java
@@ -26,7 +26,6 @@ import org.apache.james.util.docker.DockerGenericContainer;
 import org.apache.james.util.docker.Images;
 import org.awaitility.Awaitility;
 import org.elasticsearch.action.search.SearchRequest;
-import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
@@ -92,8 +91,7 @@ public class ClientProviderImplConnectionTest {
         try (RestHighLevelClient client = clientProvider.get()) {
             client.search(
                 new SearchRequest()
-                    .source(new SearchSourceBuilder().query(QueryBuilders.existsQuery("any"))),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.existsQuery("any"))));
             return true;
         } catch (Exception e) {
             LOGGER.info("Caught exception while trying to connect", e);
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
index b6eb880..34abc24 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/ElasticSearchIndexerTest.java
@@ -29,7 +29,6 @@ import org.awaitility.Duration;
 import org.awaitility.core.ConditionFactory;
 import org.elasticsearch.action.search.SearchRequest;
 import org.elasticsearch.action.search.SearchResponse;
-import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.index.query.QueryBuilders;
 import org.elasticsearch.search.builder.SearchSourceBuilder;
@@ -60,7 +59,8 @@ public class ElasticSearchIndexerTest {
             .useIndex(INDEX_NAME)
             .addAlias(ALIAS_NAME)
             .createIndexAndAliases(getESClient());
-        testee = new ElasticSearchIndexer(getESClient(), ALIAS_NAME, MINIMUM_BATCH_SIZE);
+        testee = new ElasticSearchIndexer(getESClient(),
+            ALIAS_NAME, MINIMUM_BATCH_SIZE);
     }
 
     private RestHighLevelClient getESClient() {
@@ -78,8 +78,7 @@ public class ElasticSearchIndexerTest {
         try (RestHighLevelClient client = getESClient()) {
             SearchResponse searchResponse = client.search(
                 new SearchRequest(INDEX_NAME.getValue())
-                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("message", "trying"))),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("message", "trying"))));
             assertThat(searchResponse.getHits().getTotalHits()).isEqualTo(1);
         }
     }
@@ -104,16 +103,14 @@ public class ElasticSearchIndexerTest {
         try (RestHighLevelClient client = getESClient()) {
             SearchResponse searchResponse = client.search(
                 new SearchRequest(INDEX_NAME.getValue())
-                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("message", "mastering"))),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("message", "mastering"))));
             assertThat(searchResponse.getHits().getTotalHits()).isEqualTo(1);
         }
 
         try (RestHighLevelClient client = getESClient()) {
             SearchResponse searchResponse = client.search(
                 new SearchRequest(INDEX_NAME.getValue())
-                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("field", "unchanged"))),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.matchQuery("field", "unchanged"))));
             assertThat(searchResponse.getHits().getTotalHits()).isEqualTo(1);
         }
     }
@@ -157,8 +154,7 @@ public class ElasticSearchIndexerTest {
             CALMLY_AWAIT.atMost(Duration.TEN_SECONDS)
                 .until(() -> client.search(
                         new SearchRequest(INDEX_NAME.getValue())
-                            .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())),
-                        RequestOptions.DEFAULT)
+                            .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())))
                     .getHits().getTotalHits() == 0);
         }
     }
@@ -188,8 +184,7 @@ public class ElasticSearchIndexerTest {
             CALMLY_AWAIT.atMost(Duration.TEN_SECONDS)
                 .until(() -> client.search(
                     new SearchRequest(INDEX_NAME.getValue())
-                        .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())),
-                    RequestOptions.DEFAULT)
+                        .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())))
                     .getHits().getTotalHits() == 1);
         }
     }
@@ -208,8 +203,7 @@ public class ElasticSearchIndexerTest {
         try (RestHighLevelClient client = getESClient()) {
             SearchResponse searchResponse = client.search(
                 new SearchRequest(INDEX_NAME.getValue())
-                    .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())));
             assertThat(searchResponse.getHits().getTotalHits()).isEqualTo(0);
         }
     }
@@ -238,8 +232,7 @@ public class ElasticSearchIndexerTest {
         try (RestHighLevelClient client = getESClient()) {
             SearchResponse searchResponse = client.search(
                 new SearchRequest(INDEX_NAME.getValue())
-                    .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())),
-                RequestOptions.DEFAULT);
+                    .source(new SearchSourceBuilder().query(QueryBuilders.matchAllQuery())));
             assertThat(searchResponse.getHits().getTotalHits()).isEqualTo(1);
         }
     }
diff --git a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
index a6507a8..c52847c 100644
--- a/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
+++ b/backends-common/elasticsearch/src/test/java/org/apache/james/backends/es/search/ScrollIterableTest.java
@@ -38,7 +38,6 @@ import org.awaitility.Duration;
 import org.awaitility.core.ConditionFactory;
 import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.search.SearchRequest;
-import org.elasticsearch.client.RequestOptions;
 import org.elasticsearch.client.RestHighLevelClient;
 import org.elasticsearch.common.unit.TimeValue;
 import org.elasticsearch.index.query.QueryBuilders;
@@ -93,8 +92,7 @@ public class ScrollIterableTest {
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             elasticSearch.awaitForElasticSearch();
             WAIT_CONDITION.untilAsserted(() -> hasIdsInIndex(client, id));
@@ -117,15 +115,13 @@ public class ScrollIterableTest {
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id1)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             String id2 = "2";
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id2)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             elasticSearch.awaitForElasticSearch();
             WAIT_CONDITION.untilAsserted(() -> hasIdsInIndex(client, id1, id2));
@@ -148,22 +144,19 @@ public class ScrollIterableTest {
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id1)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             String id2 = "2";
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id2)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             String id3 = "3";
             client.index(new IndexRequest(INDEX_NAME.getValue())
                     .type(NodeMappingFactory.DEFAULT_MAPPING_NAME)
                     .id(id3)
-                    .source(MESSAGE, "Sample message"),
-                RequestOptions.DEFAULT);
+                    .source(MESSAGE, "Sample message"));
 
             elasticSearch.awaitForElasticSearch();
             WAIT_CONDITION.untilAsserted(() -> hasIdsInIndex(client, id1, id2, id3));
@@ -192,7 +185,7 @@ public class ScrollIterableTest {
             .source(new SearchSourceBuilder()
                 .query(QueryBuilders.matchAllQuery()));
 
-        SearchHit[] hits = client.search(searchRequest, RequestOptions.DEFAULT)
+        SearchHit[] hits = client.search(searchRequest)
             .getHits()
             .getHits();
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org