Fix line length for org.elasticsearch.action.* files (#35607)
This removes the checkstyle suppressions for things in the `action` package. Relates to #34884
This commit is contained in:
parent
022726011c
commit
22933ebcd5
|
@ -45,18 +45,6 @@
|
|||
|
||||
<!-- Hopefully temporary suppression of LineLength on files that don't pass it. We should remove these when we the
|
||||
files start to pass. -->
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]MultiSearchRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhaseController.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]MultiTermVectorsRequest.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TermVectorsRequest.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TermVectorsResponse.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TermVectorsWriter.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TransportMultiTermVectorsAction.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TransportShardMultiTermsVectorAction.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TransportTermVectorsAction.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]update[/\\]TransportUpdateAction.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]update[/\\]UpdateRequest.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]update[/\\]UpdateRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]CompositeIndexEventListener.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]IndexSettings.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]MergePolicyConfig.java" checks="LineLength" />
|
||||
|
@ -151,13 +139,6 @@
|
|||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]snapshots[/\\]SnapshotsService.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]threadpool[/\\]ThreadPool.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]VersionTests.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]RejectionActionIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]admin[/\\]HotThreadsIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchRequestBuilderTests.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]AbstractTermVectorsTestCase.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]GetTermVectorsIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]MultiTermVectorsIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]termvectors[/\\]TermVectorsUnitTests.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]aliases[/\\]IndexAliasesIT.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]deps[/\\]joda[/\\]SimpleJodaTests.java" checks="LineLength" />
|
||||
<suppress files="server[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]env[/\\]EnvironmentTests.java" checks="LineLength" />
|
||||
|
|
|
@ -170,7 +170,8 @@ public class TransportClusterHealthAction
|
|||
}
|
||||
|
||||
final ClusterState state = clusterService.state();
|
||||
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService, null, logger, threadPool.getThreadContext());
|
||||
final ClusterStateObserver observer = new ClusterStateObserver(state, clusterService,
|
||||
null, logger, threadPool.getThreadContext());
|
||||
if (request.timeout().millis() == 0) {
|
||||
listener.onResponse(getResponse(request, state, waitFor, request.timeout().millis() == 0));
|
||||
return;
|
||||
|
@ -209,8 +210,8 @@ public class TransportClusterHealthAction
|
|||
return readyCounter == waitFor;
|
||||
}
|
||||
|
||||
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState, final int waitFor,
|
||||
boolean timedOut) {
|
||||
private ClusterHealthResponse getResponse(final ClusterHealthRequest request, ClusterState clusterState,
|
||||
final int waitFor, boolean timedOut) {
|
||||
ClusterHealthResponse response = clusterHealth(request, clusterState, clusterService.getMasterService().numberOfPendingTasks(),
|
||||
gatewayAllocator.getNumberOfInFlightFetch(), clusterService.getMasterService().getMaxTaskWaitTime());
|
||||
int readyCounter = prepareResponse(request, response, clusterState, indexNameExpressionResolver);
|
||||
|
@ -325,7 +326,7 @@ public class TransportClusterHealthAction
|
|||
// one of the specified indices is not there - treat it as RED.
|
||||
ClusterHealthResponse response = new ClusterHealthResponse(clusterState.getClusterName().value(), Strings.EMPTY_ARRAY,
|
||||
clusterState, numberOfPendingTasks, numberOfInFlightFetch, UnassignedInfo.getNumberOfDelayedUnassigned(clusterState),
|
||||
pendingTaskTimeInQueue);
|
||||
pendingTaskTimeInQueue);
|
||||
response.setStatus(ClusterHealthStatus.RED);
|
||||
return response;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,8 @@ public class ClusterStatsNodeResponse extends BaseNodeResponse {
|
|||
ClusterStatsNodeResponse() {
|
||||
}
|
||||
|
||||
public ClusterStatsNodeResponse(DiscoveryNode node, @Nullable ClusterHealthStatus clusterStatus, NodeInfo nodeInfo,
|
||||
NodeStats nodeStats, ShardStats[] shardsStats) {
|
||||
public ClusterStatsNodeResponse(DiscoveryNode node, @Nullable ClusterHealthStatus clusterStatus,
|
||||
NodeInfo nodeInfo, NodeStats nodeStats, ShardStats[] shardsStats) {
|
||||
super(node);
|
||||
this.nodeInfo = nodeInfo;
|
||||
this.nodeStats = nodeStats;
|
||||
|
|
|
@ -171,7 +171,8 @@ public final class SearchPhaseController {
|
|||
final TopDocsAndMaxScore td = queryResult.consumeTopDocs();
|
||||
assert td != null;
|
||||
topDocsStats.add(td);
|
||||
if (td.topDocs.scoreDocs.length > 0) { // make sure we set the shard index before we add it - the consumer didn't do that yet
|
||||
// make sure we set the shard index before we add it - the consumer didn't do that yet
|
||||
if (td.topDocs.scoreDocs.length > 0) {
|
||||
setShardIndex(td.topDocs, queryResult.getShardIndex());
|
||||
topDocs.add(td.topDocs);
|
||||
}
|
||||
|
@ -308,7 +309,8 @@ public final class SearchPhaseController {
|
|||
* completion suggestion ordered by suggestion name
|
||||
*/
|
||||
public InternalSearchResponse merge(boolean ignoreFrom, ReducedQueryPhase reducedQueryPhase,
|
||||
Collection<? extends SearchPhaseResult> fetchResults, IntFunction<SearchPhaseResult> resultsLookup) {
|
||||
Collection<? extends SearchPhaseResult> fetchResults,
|
||||
IntFunction<SearchPhaseResult> resultsLookup) {
|
||||
if (reducedQueryPhase.isEmptyResult) {
|
||||
return InternalSearchResponse.empty();
|
||||
}
|
||||
|
@ -416,7 +418,8 @@ public final class SearchPhaseController {
|
|||
* Reduces the given query results and consumes all aggregations and profile results.
|
||||
* @param queryResults a list of non-null query shard results
|
||||
*/
|
||||
public ReducedQueryPhase reducedQueryPhase(Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits) {
|
||||
public ReducedQueryPhase reducedQueryPhase(Collection<? extends SearchPhaseResult> queryResults,
|
||||
boolean isScrollRequest, boolean trackTotalHits) {
|
||||
return reducedQueryPhase(queryResults, null, new ArrayList<>(), new TopDocsStats(trackTotalHits), 0, isScrollRequest);
|
||||
}
|
||||
|
||||
|
@ -441,7 +444,8 @@ public final class SearchPhaseController {
|
|||
Boolean terminatedEarly = null;
|
||||
if (queryResults.isEmpty()) { // early terminate we have nothing to reduce
|
||||
return new ReducedQueryPhase(topDocsStats.totalHits, topDocsStats.fetchHits, topDocsStats.maxScore,
|
||||
timedOut, terminatedEarly, null, null, null, EMPTY_DOCS, null, null, numReducePhases, false, 0, 0, true);
|
||||
timedOut, terminatedEarly, null, null, null, EMPTY_DOCS, null,
|
||||
null, numReducePhases, false, 0, 0, true);
|
||||
}
|
||||
final QuerySearchResult firstResult = queryResults.stream().findFirst().get().queryResult();
|
||||
final boolean hasSuggest = firstResult.suggest() != null;
|
||||
|
@ -671,7 +675,8 @@ public final class SearchPhaseController {
|
|||
}
|
||||
if (hasTopDocs) {
|
||||
TopDocs reducedTopDocs = controller.mergeTopDocs(Arrays.asList(topDocsBuffer),
|
||||
querySearchResult.from() + querySearchResult.size() // we have to merge here in the same way we collect on a shard
|
||||
// we have to merge here in the same way we collect on a shard
|
||||
querySearchResult.from() + querySearchResult.size()
|
||||
, 0);
|
||||
Arrays.fill(topDocsBuffer, null);
|
||||
topDocsBuffer[0] = reducedTopDocs;
|
||||
|
|
|
@ -38,7 +38,8 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class MultiTermVectorsRequest extends ActionRequest implements Iterable<TermVectorsRequest>, CompositeIndicesRequest, RealtimeRequest {
|
||||
public class MultiTermVectorsRequest extends ActionRequest
|
||||
implements Iterable<TermVectorsRequest>, CompositeIndicesRequest, RealtimeRequest {
|
||||
|
||||
String preference;
|
||||
List<TermVectorsRequest> requests = new ArrayList<>();
|
||||
|
|
|
@ -616,18 +616,21 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
|
|||
termVectorsRequest.perFieldAnalyzer(readPerFieldAnalyzer(parser.map()));
|
||||
} else if (FILTER.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
termVectorsRequest.filterSettings(readFilterSettings(parser));
|
||||
} else if (INDEX.match(currentFieldName, parser.getDeprecationHandler())) { // the following is important for multi request parsing.
|
||||
} else if (INDEX.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
// the following is important for multi request parsing.
|
||||
termVectorsRequest.index = parser.text();
|
||||
} else if (TYPE.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
termVectorsRequest.type = parser.text();
|
||||
} else if (ID.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (termVectorsRequest.doc != null) {
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. either [id] or [doc] can be specified, but not both!");
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. " +
|
||||
"either [id] or [doc] can be specified, but not both!");
|
||||
}
|
||||
termVectorsRequest.id = parser.text();
|
||||
} else if (DOC.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
if (termVectorsRequest.id != null) {
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. either [id] or [doc] can be specified, but not both!");
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. " +
|
||||
"either [id] or [doc] can be specified, but not both!");
|
||||
}
|
||||
termVectorsRequest.doc(jsonBuilder().copyCurrentStructure(parser));
|
||||
} else if (ROUTING.match(currentFieldName, parser.getDeprecationHandler())) {
|
||||
|
@ -653,7 +656,8 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
|
|||
if (e.getValue() instanceof String) {
|
||||
mapStrStr.put(e.getKey(), (String) e.getValue());
|
||||
} else {
|
||||
throw new ElasticsearchParseException("expecting the analyzer at [{}] to be a String, but found [{}] instead", e.getKey(), e.getValue().getClass());
|
||||
throw new ElasticsearchParseException("expecting the analyzer at [{}] to be a String, but found [{}] instead",
|
||||
e.getKey(), e.getValue().getClass());
|
||||
}
|
||||
}
|
||||
return mapStrStr;
|
||||
|
@ -682,7 +686,8 @@ public class TermVectorsRequest extends SingleShardRequest<TermVectorsRequest> i
|
|||
} else if (currentFieldName.equals("max_word_length")) {
|
||||
settings.maxWordLength = parser.intValue();
|
||||
} else {
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. the field [{}] is not valid for filter parameter for term vector request", currentFieldName);
|
||||
throw new ElasticsearchParseException("failed to parse term vectors request. " +
|
||||
"the field [{}] is not valid for filter parameter for term vector request", currentFieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -197,7 +197,8 @@ public class TermVectorsResponse extends ActionResponse implements ToXContentObj
|
|||
return builder;
|
||||
}
|
||||
|
||||
private void buildField(XContentBuilder builder, final CharsRefBuilder spare, Fields theFields, Iterator<String> fieldIter) throws IOException {
|
||||
private void buildField(XContentBuilder builder, final CharsRefBuilder spare,
|
||||
Fields theFields, Iterator<String> fieldIter) throws IOException {
|
||||
String fieldName = fieldIter.next();
|
||||
builder.startObject(fieldName);
|
||||
Terms curTerms = theFields.terms(fieldName);
|
||||
|
@ -213,7 +214,8 @@ public class TermVectorsResponse extends ActionResponse implements ToXContentObj
|
|||
builder.endObject();
|
||||
}
|
||||
|
||||
private void buildTerm(XContentBuilder builder, final CharsRefBuilder spare, Terms curTerms, TermsEnum termIter, BoostAttribute boostAtt) throws IOException {
|
||||
private void buildTerm(XContentBuilder builder, final CharsRefBuilder spare, Terms curTerms,
|
||||
TermsEnum termIter, BoostAttribute boostAtt) throws IOException {
|
||||
// start term, optimized writing
|
||||
BytesRef term = termIter.next();
|
||||
spare.copyUTF8Bytes(term);
|
||||
|
@ -235,7 +237,8 @@ public class TermVectorsResponse extends ActionResponse implements ToXContentObj
|
|||
// boolean that says if these values actually were requested.
|
||||
// However, we can assume that they were not if the statistic values are
|
||||
// <= 0.
|
||||
assert (((termIter.docFreq() > 0) && (termIter.totalTermFreq() > 0)) || ((termIter.docFreq() == -1) && (termIter.totalTermFreq() == -1)));
|
||||
assert (((termIter.docFreq() > 0) && (termIter.totalTermFreq() > 0)) ||
|
||||
((termIter.docFreq() == -1) && (termIter.totalTermFreq() == -1)));
|
||||
int docFreq = termIter.docFreq();
|
||||
if (docFreq > 0) {
|
||||
builder.field(FieldStrings.DOC_FREQ, docFreq);
|
||||
|
@ -349,12 +352,13 @@ public class TermVectorsResponse extends ActionResponse implements ToXContentObj
|
|||
this.exists = exists;
|
||||
}
|
||||
|
||||
public void setFields(Fields termVectorsByField, Set<String> selectedFields, EnumSet<Flag> flags, Fields topLevelFields) throws IOException {
|
||||
public void setFields(Fields termVectorsByField, Set<String> selectedFields,
|
||||
EnumSet<Flag> flags, Fields topLevelFields) throws IOException {
|
||||
setFields(termVectorsByField, selectedFields, flags, topLevelFields, null, null);
|
||||
}
|
||||
|
||||
public void setFields(Fields termVectorsByField, Set<String> selectedFields, EnumSet<Flag> flags, Fields topLevelFields, @Nullable AggregatedDfs dfs,
|
||||
TermVectorsFilter termVectorsFilter) throws IOException {
|
||||
public void setFields(Fields termVectorsByField, Set<String> selectedFields, EnumSet<Flag> flags,
|
||||
Fields topLevelFields, @Nullable AggregatedDfs dfs, TermVectorsFilter termVectorsFilter) throws IOException {
|
||||
TermVectorsWriter tvw = new TermVectorsWriter(this);
|
||||
|
||||
if (termVectorsByField != null) {
|
||||
|
|
|
@ -141,10 +141,12 @@ final class TermVectorsWriter {
|
|||
numFieldsWritten++;
|
||||
}
|
||||
response.setTermVectorsField(output);
|
||||
response.setHeader(writeHeader(numFieldsWritten, flags.contains(Flag.TermStatistics), flags.contains(Flag.FieldStatistics), hasScores));
|
||||
response.setHeader(writeHeader(numFieldsWritten, flags.contains(Flag.TermStatistics),
|
||||
flags.contains(Flag.FieldStatistics), hasScores));
|
||||
}
|
||||
|
||||
private BytesReference writeHeader(int numFieldsWritten, boolean getTermStatistics, boolean getFieldStatistics, boolean scores) throws IOException {
|
||||
private BytesReference writeHeader(int numFieldsWritten, boolean getTermStatistics,
|
||||
boolean getFieldStatistics, boolean scores) throws IOException {
|
||||
// now, write the information about offset of the terms in the
|
||||
// termVectors field
|
||||
BytesStreamOutput header = new BytesStreamOutput();
|
||||
|
|
|
@ -64,16 +64,20 @@ public class TransportMultiTermVectorsAction extends HandledTransportAction<Mult
|
|||
Map<ShardId, MultiTermVectorsShardRequest> shardRequests = new HashMap<>();
|
||||
for (int i = 0; i < request.requests.size(); i++) {
|
||||
TermVectorsRequest termVectorsRequest = request.requests.get(i);
|
||||
termVectorsRequest.routing(clusterState.metaData().resolveIndexRouting(termVectorsRequest.routing(), termVectorsRequest.index()));
|
||||
termVectorsRequest.routing(clusterState.metaData().resolveIndexRouting(termVectorsRequest.routing(),
|
||||
termVectorsRequest.index()));
|
||||
if (!clusterState.metaData().hasConcreteIndex(termVectorsRequest.index())) {
|
||||
responses.set(i, new MultiTermVectorsItemResponse(null, new MultiTermVectorsResponse.Failure(termVectorsRequest.index(),
|
||||
termVectorsRequest.type(), termVectorsRequest.id(), new IndexNotFoundException(termVectorsRequest.index()))));
|
||||
continue;
|
||||
}
|
||||
String concreteSingleIndex = indexNameExpressionResolver.concreteSingleIndex(clusterState, termVectorsRequest).getName();
|
||||
if (termVectorsRequest.routing() == null && clusterState.getMetaData().routingRequired(concreteSingleIndex, termVectorsRequest.type())) {
|
||||
responses.set(i, new MultiTermVectorsItemResponse(null, new MultiTermVectorsResponse.Failure(concreteSingleIndex, termVectorsRequest.type(), termVectorsRequest.id(),
|
||||
new IllegalArgumentException("routing is required for [" + concreteSingleIndex + "]/[" + termVectorsRequest.type() + "]/[" + termVectorsRequest.id() + "]"))));
|
||||
if (termVectorsRequest.routing() == null &&
|
||||
clusterState.getMetaData().routingRequired(concreteSingleIndex, termVectorsRequest.type())) {
|
||||
responses.set(i, new MultiTermVectorsItemResponse(null,
|
||||
new MultiTermVectorsResponse.Failure(concreteSingleIndex, termVectorsRequest.type(), termVectorsRequest.id(),
|
||||
new IllegalArgumentException("routing is required for [" + concreteSingleIndex + "]/[" +
|
||||
termVectorsRequest.type() + "]/[" + termVectorsRequest.id() + "]"))));
|
||||
continue;
|
||||
}
|
||||
ShardId shardId = clusterService.operationRouting().shardId(clusterState, concreteSingleIndex,
|
||||
|
|
|
@ -36,7 +36,8 @@ import org.elasticsearch.indices.IndicesService;
|
|||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
public class TransportShardMultiTermsVectorAction extends TransportSingleShardAction<MultiTermVectorsShardRequest, MultiTermVectorsShardResponse> {
|
||||
public class TransportShardMultiTermsVectorAction extends
|
||||
TransportSingleShardAction<MultiTermVectorsShardRequest, MultiTermVectorsShardResponse> {
|
||||
|
||||
private final IndicesService indicesService;
|
||||
|
||||
|
@ -86,7 +87,8 @@ public class TransportShardMultiTermsVectorAction extends TransportSingleShardAc
|
|||
if (TransportActions.isShardNotAvailableException(e)) {
|
||||
throw e;
|
||||
} else {
|
||||
logger.debug(() -> new ParameterizedMessage("{} failed to execute multi term vectors for [{}]/[{}]", shardId, termVectorsRequest.type(), termVectorsRequest.id()), e);
|
||||
logger.debug(() -> new ParameterizedMessage("{} failed to execute multi term vectors for [{}]/[{}]",
|
||||
shardId, termVectorsRequest.type(), termVectorsRequest.id()), e);
|
||||
response.add(request.locations.get(i),
|
||||
new MultiTermVectorsResponse.Failure(request.index(), termVectorsRequest.type(), termVectorsRequest.id(), e));
|
||||
}
|
||||
|
|
|
@ -85,7 +85,8 @@ public class TransportTermVectorsAction extends TransportSingleShardAction<TermV
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void asyncShardOperation(TermVectorsRequest request, ShardId shardId, ActionListener<TermVectorsResponse> listener) throws IOException {
|
||||
protected void asyncShardOperation(TermVectorsRequest request, ShardId shardId,
|
||||
ActionListener<TermVectorsResponse> listener) throws IOException {
|
||||
IndexService indexService = indicesService.indexServiceSafe(shardId.getIndex());
|
||||
IndexShard indexShard = indexService.getShard(shardId.id());
|
||||
if (request.realtime()) { // it's a realtime request which is not subject to refresh cycles
|
||||
|
|
|
@ -75,7 +75,8 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
UpdateHelper updateHelper, ActionFilters actionFilters,
|
||||
IndexNameExpressionResolver indexNameExpressionResolver, IndicesService indicesService,
|
||||
AutoCreateIndex autoCreateIndex, NodeClient client) {
|
||||
super(UpdateAction.NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, UpdateRequest::new);
|
||||
super(UpdateAction.NAME, threadPool, clusterService, transportService, actionFilters,
|
||||
indexNameExpressionResolver, UpdateRequest::new);
|
||||
this.updateHelper = updateHelper;
|
||||
this.indicesService = indicesService;
|
||||
this.autoCreateIndex = autoCreateIndex;
|
||||
|
@ -114,7 +115,8 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
protected void doExecute(Task task, final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
// if we don't have a master, we don't have metadata, that's fine, let it find a master using create index API
|
||||
if (autoCreateIndex.shouldAutoCreate(request.index(), clusterService.state())) {
|
||||
client.admin().indices().create(new CreateIndexRequest().index(request.index()).cause("auto(update api)").masterNodeTimeout(request.timeout()), new ActionListener<CreateIndexResponse>() {
|
||||
client.admin().indices().create(new CreateIndexRequest().index(request.index()).cause("auto(update api)")
|
||||
.masterNodeTimeout(request.timeout()), new ActionListener<CreateIndexResponse>() {
|
||||
@Override
|
||||
public void onResponse(CreateIndexResponse result) {
|
||||
innerExecute(task, request, listener);
|
||||
|
@ -177,11 +179,14 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
final BytesReference upsertSourceBytes = upsertRequest.source();
|
||||
client.bulk(toSingleItemBulkRequest(upsertRequest), wrapBulkResponse(
|
||||
ActionListener.<IndexResponse>wrap(response -> {
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(), response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(), response.getVersion(), response.getResult());
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(),
|
||||
response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(),
|
||||
response.getVersion(), response.getResult());
|
||||
if (request.fetchSource() != null && request.fetchSource().fetchSource()) {
|
||||
Tuple<XContentType, Map<String, Object>> sourceAndContent =
|
||||
XContentHelper.convertToMap(upsertSourceBytes, true, upsertRequest.getContentType());
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(), sourceAndContent.v2(), sourceAndContent.v1(), upsertSourceBytes));
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(),
|
||||
sourceAndContent.v2(), sourceAndContent.v1(), upsertSourceBytes));
|
||||
} else {
|
||||
update.setGetResult(null);
|
||||
}
|
||||
|
@ -197,8 +202,11 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
final BytesReference indexSourceBytes = indexRequest.source();
|
||||
client.bulk(toSingleItemBulkRequest(indexRequest), wrapBulkResponse(
|
||||
ActionListener.<IndexResponse>wrap(response -> {
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(), response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(), response.getVersion(), response.getResult());
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(), result.updatedSourceAsMap(), result.updateSourceContentType(), indexSourceBytes));
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(),
|
||||
response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(),
|
||||
response.getVersion(), response.getResult());
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(),
|
||||
result.updatedSourceAsMap(), result.updateSourceContentType(), indexSourceBytes));
|
||||
update.setForcedRefresh(response.forcedRefresh());
|
||||
listener.onResponse(update);
|
||||
}, exception -> handleUpdateFailureWithRetry(listener, request, exception, retryCount)))
|
||||
|
@ -208,8 +216,11 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
DeleteRequest deleteRequest = result.action();
|
||||
client.bulk(toSingleItemBulkRequest(deleteRequest), wrapBulkResponse(
|
||||
ActionListener.<DeleteResponse>wrap(response -> {
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(), response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(), response.getVersion(), response.getResult());
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(), result.updatedSourceAsMap(), result.updateSourceContentType(), null));
|
||||
UpdateResponse update = new UpdateResponse(response.getShardInfo(), response.getShardId(),
|
||||
response.getType(), response.getId(), response.getSeqNo(), response.getPrimaryTerm(),
|
||||
response.getVersion(), response.getResult());
|
||||
update.setGetResult(UpdateHelper.extractGetResult(request, request.concreteIndex(), response.getVersion(),
|
||||
result.updatedSourceAsMap(), result.updateSourceContentType(), null));
|
||||
update.setForcedRefresh(response.forcedRefresh());
|
||||
listener.onResponse(update);
|
||||
}, exception -> handleUpdateFailureWithRetry(listener, request, exception, retryCount)))
|
||||
|
|
|
@ -149,11 +149,13 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
} else {
|
||||
|
||||
if (version != Versions.MATCH_ANY && retryOnConflict > 0) {
|
||||
validationException = addValidationError("can't provide both retry_on_conflict and a specific version", validationException);
|
||||
validationException = addValidationError("can't provide both retry_on_conflict and a specific version",
|
||||
validationException);
|
||||
}
|
||||
|
||||
if (!versionType.validateVersionForWrites(version)) {
|
||||
validationException = addValidationError("illegal version value [" + version + "] for version type [" + versionType.name() + "]", validationException);
|
||||
validationException = addValidationError("illegal version value [" + version + "] for version type [" +
|
||||
versionType.name() + "]", validationException);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,8 +620,8 @@ public class UpdateRequest extends InstanceShardOperationRequest<UpdateRequest>
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the index request to be used if the document does not exists. Otherwise, a {@link org.elasticsearch.index.engine.DocumentMissingException}
|
||||
* is thrown.
|
||||
* Sets the index request to be used if the document does not exists. Otherwise, a
|
||||
* {@link org.elasticsearch.index.engine.DocumentMissingException} is thrown.
|
||||
*/
|
||||
public UpdateRequest upsert(IndexRequest upsertRequest) {
|
||||
this.upsertRequest = upsertRequest;
|
||||
|
|
|
@ -243,8 +243,8 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the index request to be used if the document does not exists. Otherwise, a {@link org.elasticsearch.index.engine.DocumentMissingException}
|
||||
* is thrown.
|
||||
* Sets the index request to be used if the document does not exists. Otherwise, a
|
||||
* {@link org.elasticsearch.index.engine.DocumentMissingException} is thrown.
|
||||
*/
|
||||
public UpdateRequestBuilder setUpsert(IndexRequest indexRequest) {
|
||||
request.upsert(indexRequest);
|
||||
|
|
|
@ -87,7 +87,8 @@ public class RejectionActionIT extends ESIntegTestCase {
|
|||
if (response instanceof SearchResponse) {
|
||||
SearchResponse searchResponse = (SearchResponse) response;
|
||||
for (ShardSearchFailure failure : searchResponse.getShardFailures()) {
|
||||
assertTrue("got unexpected reason..." + failure.reason(), failure.reason().toLowerCase(Locale.ENGLISH).contains("rejected"));
|
||||
assertTrue("got unexpected reason..." + failure.reason(),
|
||||
failure.reason().toLowerCase(Locale.ENGLISH).contains("rejected"));
|
||||
}
|
||||
} else {
|
||||
Exception t = (Exception) response;
|
||||
|
@ -95,7 +96,8 @@ public class RejectionActionIT extends ESIntegTestCase {
|
|||
if (unwrap instanceof SearchPhaseExecutionException) {
|
||||
SearchPhaseExecutionException e = (SearchPhaseExecutionException) unwrap;
|
||||
for (ShardSearchFailure failure : e.shardFailures()) {
|
||||
assertTrue("got unexpected reason..." + failure.reason(), failure.reason().toLowerCase(Locale.ENGLISH).contains("rejected"));
|
||||
assertTrue("got unexpected reason..." + failure.reason(),
|
||||
failure.reason().toLowerCase(Locale.ENGLISH).contains("rejected"));
|
||||
}
|
||||
} else if ((unwrap instanceof EsRejectedExecutionException) == false) {
|
||||
throw new AssertionError("unexpected failure", (Throwable) response);
|
||||
|
|
|
@ -120,7 +120,8 @@ public class HotThreadsIT extends ESIntegTestCase {
|
|||
assertHitCount(
|
||||
client().prepareSearch()
|
||||
.setQuery(matchAllQuery())
|
||||
.setPostFilter(boolQuery().must(matchAllQuery()).mustNot(boolQuery().must(termQuery("field1", "value1")).must(termQuery("field1", "value2"))))
|
||||
.setPostFilter(boolQuery().must(matchAllQuery()).mustNot(boolQuery()
|
||||
.must(termQuery("field1", "value1")).must(termQuery("field1", "value2"))))
|
||||
.get(),
|
||||
3L);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ public class ClusterHealthResponsesTests extends AbstractStreamableXContentTestC
|
|||
int inFlight = randomIntBetween(0, 200);
|
||||
int delayedUnassigned = randomIntBetween(0, 200);
|
||||
TimeValue pendingTaskInQueueTime = TimeValue.timeValueMillis(randomIntBetween(1000, 100000));
|
||||
ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", new String[] {MetaData.ALL}, clusterState, pendingTasks,
|
||||
inFlight, delayedUnassigned, pendingTaskInQueueTime);
|
||||
ClusterHealthResponse clusterHealth = new ClusterHealthResponse("bla", new String[] {MetaData.ALL},
|
||||
clusterState, pendingTasks, inFlight, delayedUnassigned, pendingTaskInQueueTime);
|
||||
clusterHealth = maybeSerialize(clusterHealth);
|
||||
assertClusterHealth(clusterHealth);
|
||||
assertThat(clusterHealth.getNumberOfPendingTasks(), Matchers.equalTo(pendingTasks));
|
||||
|
|
|
@ -66,8 +66,8 @@ public class RepositoryBlocksIT extends ESIntegTestCase {
|
|||
// This test checks that the Get Repository operation is never blocked, even if the cluster is read only.
|
||||
try {
|
||||
setClusterReadOnly(true);
|
||||
VerifyRepositoryResponse response = client().admin().cluster().prepareVerifyRepository("test-repo-blocks").execute()
|
||||
.actionGet();
|
||||
VerifyRepositoryResponse response = client().admin().cluster()
|
||||
.prepareVerifyRepository("test-repo-blocks").execute().actionGet();
|
||||
assertThat(response.getNodes().size(), equalTo(cluster().numDataAndMasterNodes()));
|
||||
} finally {
|
||||
setClusterReadOnly(false);
|
||||
|
|
|
@ -88,10 +88,8 @@ public class SnapshotBlocksIT extends ESIntegTestCase {
|
|||
logger.info("--> creating a snapshot is allowed when the cluster is read only");
|
||||
try {
|
||||
setClusterReadOnly(true);
|
||||
assertThat(
|
||||
client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1").setWaitForCompletion(true).get().status(),
|
||||
equalTo(RestStatus.OK)
|
||||
);
|
||||
assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1")
|
||||
.setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
|
||||
} finally {
|
||||
setClusterReadOnly(false);
|
||||
}
|
||||
|
@ -107,11 +105,8 @@ public class SnapshotBlocksIT extends ESIntegTestCase {
|
|||
logger.info("--> creating a snapshot is not blocked when an index is read only");
|
||||
try {
|
||||
enableIndexBlock(INDEX_NAME, SETTING_READ_ONLY);
|
||||
assertThat(
|
||||
client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1")
|
||||
.setIndices(COMMON_INDEX_NAME_MASK).setWaitForCompletion(true).get().status(),
|
||||
equalTo(RestStatus.OK)
|
||||
);
|
||||
assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-1")
|
||||
.setIndices(COMMON_INDEX_NAME_MASK).setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
|
||||
} finally {
|
||||
disableIndexBlock(INDEX_NAME, SETTING_READ_ONLY);
|
||||
}
|
||||
|
@ -119,16 +114,11 @@ public class SnapshotBlocksIT extends ESIntegTestCase {
|
|||
logger.info("--> creating a snapshot is blocked when an index is blocked for reads");
|
||||
try {
|
||||
enableIndexBlock(INDEX_NAME, SETTING_BLOCKS_READ);
|
||||
assertBlocked(
|
||||
client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").setIndices(COMMON_INDEX_NAME_MASK),
|
||||
IndexMetaData.INDEX_READ_BLOCK
|
||||
);
|
||||
assertBlocked(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2")
|
||||
.setIndices(COMMON_INDEX_NAME_MASK), IndexMetaData.INDEX_READ_BLOCK);
|
||||
logger.info("--> creating a snapshot is not blocked when an read-blocked index is not part of the snapshot");
|
||||
assertThat(
|
||||
client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2").
|
||||
setIndices(OTHER_INDEX_NAME).setWaitForCompletion(true).get().status(),
|
||||
equalTo(RestStatus.OK)
|
||||
);
|
||||
assertThat(client().admin().cluster().prepareCreateSnapshot(REPOSITORY_NAME, "snapshot-2")
|
||||
.setIndices(OTHER_INDEX_NAME).setWaitForCompletion(true).get().status(), equalTo(RestStatus.OK));
|
||||
} finally {
|
||||
disableIndexBlock(INDEX_NAME, SETTING_BLOCKS_READ);
|
||||
}
|
||||
|
@ -151,10 +141,8 @@ public class SnapshotBlocksIT extends ESIntegTestCase {
|
|||
logger.info("--> restoring a snapshot is blocked when the cluster is read only");
|
||||
try {
|
||||
setClusterReadOnly(true);
|
||||
assertBlocked(
|
||||
client().admin().cluster().prepareRestoreSnapshot(REPOSITORY_NAME, SNAPSHOT_NAME),
|
||||
MetaData.CLUSTER_READ_ONLY_BLOCK
|
||||
);
|
||||
assertBlocked(client().admin().cluster().prepareRestoreSnapshot(REPOSITORY_NAME, SNAPSHOT_NAME),
|
||||
MetaData.CLUSTER_READ_ONLY_BLOCK);
|
||||
} finally {
|
||||
setClusterReadOnly(false);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,8 @@ public class ClusterStateRequestTests extends ESTestCase {
|
|||
ClusterStateRequest clusterStateRequest = new ClusterStateRequest().routingTable(randomBoolean()).metaData(randomBoolean())
|
||||
.nodes(randomBoolean()).blocks(randomBoolean()).indices("testindex", "testindex2").indicesOptions(indicesOptions);
|
||||
|
||||
Version testVersion = VersionUtils.randomVersionBetween(random(), Version.CURRENT.minimumCompatibilityVersion(),
|
||||
Version.CURRENT);
|
||||
Version testVersion = VersionUtils.randomVersionBetween(random(),
|
||||
Version.CURRENT.minimumCompatibilityVersion(), Version.CURRENT);
|
||||
BytesStreamOutput output = new BytesStreamOutput();
|
||||
output.setVersion(testVersion);
|
||||
clusterStateRequest.writeTo(output);
|
||||
|
|
|
@ -54,8 +54,8 @@ public class ClusterStatsIT extends ESIntegTestCase {
|
|||
|
||||
private void waitForNodes(int numNodes) {
|
||||
ClusterHealthResponse actionGet = client().admin().cluster()
|
||||
.health(Requests.clusterHealthRequest().waitForEvents(Priority.LANGUID).waitForNodes(Integer.toString(numNodes)))
|
||||
.actionGet();
|
||||
.health(Requests.clusterHealthRequest().waitForEvents(Priority.LANGUID)
|
||||
.waitForNodes(Integer.toString(numNodes))).actionGet();
|
||||
assertThat(actionGet.isTimedOut(), is(false));
|
||||
}
|
||||
|
||||
|
|
|
@ -64,13 +64,16 @@ public class SearchRequestBuilderTests extends ESTestCase {
|
|||
public void testSearchSourceBuilderToString() {
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch();
|
||||
searchRequestBuilder.setSource(new SearchSourceBuilder().query(QueryBuilders.termQuery("field", "value")));
|
||||
assertThat(searchRequestBuilder.toString(), equalTo(new SearchSourceBuilder().query(QueryBuilders.termQuery("field", "value")).toString()));
|
||||
assertThat(searchRequestBuilder.toString(), equalTo(new SearchSourceBuilder()
|
||||
.query(QueryBuilders.termQuery("field", "value")).toString()));
|
||||
}
|
||||
|
||||
public void testThatToStringDoesntWipeRequestSource() {
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch().setSource(new SearchSourceBuilder().query(QueryBuilders.termQuery("field", "value")));
|
||||
SearchRequestBuilder searchRequestBuilder = client.prepareSearch()
|
||||
.setSource(new SearchSourceBuilder().query(QueryBuilders.termQuery("field", "value")));
|
||||
String preToString = searchRequestBuilder.request().toString();
|
||||
assertThat(searchRequestBuilder.toString(), equalTo(new SearchSourceBuilder().query(QueryBuilders.termQuery("field", "value")).toString()));
|
||||
assertThat(searchRequestBuilder.toString(), equalTo(new SearchSourceBuilder()
|
||||
.query(QueryBuilders.termQuery("field", "value")).toString()));
|
||||
String postToString = searchRequestBuilder.request().toString();
|
||||
assertThat(preToString, equalTo(postToString));
|
||||
}
|
||||
|
|
|
@ -272,8 +272,10 @@ public abstract class AbstractTermVectorsTestCase extends ESIntegTestCase {
|
|||
configs.add(config);
|
||||
}
|
||||
// always adds a test that fails
|
||||
configs.add(new TestConfig(new TestDoc("doesnt_exist", new TestFieldSetting[]{}, new String[]{}).index("doesn't_exist").alias("doesn't_exist"),
|
||||
new String[]{"doesnt_exist"}, true, true, true).expectedException(org.elasticsearch.index.IndexNotFoundException.class));
|
||||
configs.add(new TestConfig(new TestDoc("doesnt_exist", new TestFieldSetting[]{}, new String[]{})
|
||||
.index("doesn't_exist").alias("doesn't_exist"),
|
||||
new String[]{"doesnt_exist"}, true, true, true)
|
||||
.expectedException(org.elasticsearch.index.IndexNotFoundException.class));
|
||||
|
||||
refresh();
|
||||
|
||||
|
@ -401,9 +403,10 @@ public abstract class AbstractTermVectorsTestCase extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
protected TermVectorsRequestBuilder getRequestForConfig(TestConfig config) {
|
||||
return client().prepareTermVectors(randomBoolean() ? config.doc.index : config.doc.alias, config.doc.type, config.doc.id).setPayloads(config.requestPayloads)
|
||||
.setOffsets(config.requestOffsets).setPositions(config.requestPositions).setFieldStatistics(true).setTermStatistics(true)
|
||||
.setSelectedFields(config.selectedFields).setRealtime(false);
|
||||
return client().prepareTermVectors(randomBoolean() ? config.doc.index : config.doc.alias, config.doc.type, config.doc.id)
|
||||
.setPayloads(config.requestPayloads)
|
||||
.setOffsets(config.requestOffsets).setPositions(config.requestPositions).setFieldStatistics(true).setTermStatistics(true)
|
||||
.setSelectedFields(config.selectedFields).setRealtime(false);
|
||||
}
|
||||
|
||||
protected Fields getTermVectorsFromLucene(DirectoryReader directoryReader, TestDoc doc) throws IOException {
|
||||
|
|
|
@ -765,7 +765,8 @@ public class GetTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
// check overridden by keyword analyzer ...
|
||||
if (perFieldAnalyzer.containsKey(fieldName)) {
|
||||
TermsEnum iterator = terms.iterator();
|
||||
assertThat("Analyzer for " + fieldName + " should have been overridden!", iterator.next().utf8ToString(), equalTo("some text here"));
|
||||
assertThat("Analyzer for " + fieldName + " should have been overridden!",
|
||||
iterator.next().utf8ToString(), equalTo("some text here"));
|
||||
assertThat(iterator.next(), nullValue());
|
||||
}
|
||||
validFields.add(fieldName);
|
||||
|
|
|
@ -118,7 +118,8 @@ public class MultiTermVectorsIT extends AbstractTermVectorsTestCase {
|
|||
//Version from Lucene index
|
||||
refresh();
|
||||
response = client().prepareMultiTermVectors()
|
||||
.add(new TermVectorsRequest(indexOrAlias(), "type1", "1").selectedFields("field").version(Versions.MATCH_ANY).realtime(false))
|
||||
.add(new TermVectorsRequest(indexOrAlias(), "type1", "1").selectedFields("field")
|
||||
.version(Versions.MATCH_ANY).realtime(false))
|
||||
.add(new TermVectorsRequest(indexOrAlias(), "type1", "1").selectedFields("field").version(1).realtime(false))
|
||||
.add(new TermVectorsRequest(indexOrAlias(), "type1", "1").selectedFields("field").version(2).realtime(false))
|
||||
.get();
|
||||
|
|
|
@ -269,13 +269,14 @@ public class TermVectorsUnitTests extends ESTestCase {
|
|||
String ftOpts = FieldMapper.termVectorOptionsToString(ft);
|
||||
assertThat("with_positions_payloads", equalTo(ftOpts));
|
||||
TextFieldMapper.Builder builder = new TextFieldMapper.Builder(null);
|
||||
boolean exceptiontrown = false;
|
||||
boolean exceptionThrown = false;
|
||||
try {
|
||||
TypeParsers.parseTermVector("", ftOpts, builder);
|
||||
} catch (MapperParsingException e) {
|
||||
exceptiontrown = true;
|
||||
exceptionThrown = true;
|
||||
}
|
||||
assertThat("TypeParsers.parseTermVector should accept string with_positions_payloads but does not.", exceptiontrown, equalTo(false));
|
||||
assertThat("TypeParsers.parseTermVector should accept string with_positions_payloads but does not.",
|
||||
exceptionThrown, equalTo(false));
|
||||
}
|
||||
|
||||
public void testTermVectorStringGenerationWithoutPositions() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue