Search in sources :

Example 11 with RemoteInfo

use of org.elasticsearch.index.reindex.remote.RemoteInfo in project elasticsearch by elastic.

the class ReindexRequestTests method testReindexFromRemoteDoesNotSupportSearchQuery.

public void testReindexFromRemoteDoesNotSupportSearchQuery() {
    ReindexRequest reindex = newRequest();
    reindex.setRemoteInfo(new RemoteInfo(randomAsciiOfLength(5), randomAsciiOfLength(5), between(1, Integer.MAX_VALUE), new BytesArray("real_query"), null, null, emptyMap(), RemoteInfo.DEFAULT_SOCKET_TIMEOUT, RemoteInfo.DEFAULT_CONNECT_TIMEOUT));
    // Unsupported place to put query
    reindex.getSearchRequest().source().query(matchAllQuery());
    ActionRequestValidationException e = reindex.validate();
    assertEquals("Validation Failed: 1: reindex from remote sources should use RemoteInfo's query instead of source's query;", e.getMessage());
}
Also used : BytesArray(org.elasticsearch.common.bytes.BytesArray) ActionRequestValidationException(org.elasticsearch.action.ActionRequestValidationException) RemoteInfo(org.elasticsearch.index.reindex.remote.RemoteInfo)

Aggregations

RemoteInfo (org.elasticsearch.index.reindex.remote.RemoteInfo)11 BytesArray (org.elasticsearch.common.bytes.BytesArray)7 ActionRequestValidationException (org.elasticsearch.action.ActionRequestValidationException)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 IndexRequest (org.elasticsearch.action.index.IndexRequest)2 SearchRequest (org.elasticsearch.action.search.SearchRequest)2 UncheckedIOException (java.io.UncheckedIOException)1 ArrayList (java.util.ArrayList)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.emptyMap (java.util.Collections.emptyMap)1 Collections.synchronizedList (java.util.Collections.synchronizedList)1 List (java.util.List)1 Objects (java.util.Objects)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 BiFunction (java.util.function.BiFunction)1 Function (java.util.function.Function)1 Matcher (java.util.regex.Matcher)1