mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-25 01:19:02 +00:00
Moved the percolator from core to its own module
Significant changes: * AbstractQueryTestCase has moved to the test framework module, in order for query builder tests in modules and plugins * Added support to AbstractQueryTestCase to register plugins * Lift the restriction that only one percolator could be added per index. This validation existed in MapperService, but because the percolator moved to a module it could no longer exist there. Instead of bringing it back it was removed. This validation existed since the percolator cache only supported one percolator query per document, since the percolator cache has been removed this restriction could removed as well. * While moving percolator tests to the new module, also removed a couple of tests for the deprecated percolate and mpercolate api. These APIs are now sugar APIs for bwc and rediect to the searvh and msearvh APIs. Some tests were still testing as if percolate and mpercolate API did the percolation, but this no longer the case and these tests could be removed.
This commit is contained in:
parent
3703ce804b
commit
27cc2fe4dc
@ -179,12 +179,6 @@
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]SimulatePipelineRequest.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]SimulatePipelineRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]SimulatePipelineTransportAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]MultiPercolateRequest.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]MultiPercolateRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]PercolateShardResponse.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]TransportMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]TransportPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]TransportShardMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]MultiSearchRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchPhaseExecutionException.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchResponse.java" checks="LineLength" />
|
||||
@ -453,9 +447,6 @@
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]object[/\\]ObjectMapper.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]object[/\\]RootObjectMapper.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]merge[/\\]MergeStats.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]percolator[/\\]ExtractQueryTermsService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]percolator[/\\]PercolatorFieldMapper.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]percolator[/\\]PercolatorQueriesRegistry.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]AbstractQueryBuilder.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]MatchQueryParser.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]QueryBuilders.java" checks="LineLength" />
|
||||
@ -520,7 +511,6 @@
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]jvm[/\\]JvmStats.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]Node.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]node[/\\]internal[/\\]InternalSettingsPreparer.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorQuery.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]DummyPluginInfo.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]PluginsService.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]RemovePluginCommand.java" checks="LineLength" />
|
||||
@ -566,7 +556,6 @@
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]cat[/\\]RestThreadPoolAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]get[/\\]RestMultiGetAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]index[/\\]RestIndexAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]percolate[/\\]RestPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]script[/\\]RestDeleteIndexedScriptAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]script[/\\]RestPutIndexedScriptAction.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]rest[/\\]action[/\\]search[/\\]RestClearScrollAction.java" checks="LineLength" />
|
||||
@ -745,7 +734,6 @@
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]SimulatePipelineRequestParsingTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]SimulatePipelineResponseTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]ingest[/\\]WriteableIngestDocumentTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]percolate[/\\]MultiPercolatorRequestTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]MultiSearchRequestTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]search[/\\]SearchRequestBuilderTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]action[/\\]support[/\\]AutoCreateIndexTests.java" checks="LineLength" />
|
||||
@ -981,8 +969,6 @@
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]typelevels[/\\]ParseDocumentTypeLevelsTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]update[/\\]UpdateMappingOnClusterIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]mapper[/\\]update[/\\]UpdateMappingTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]percolator[/\\]PercolatorFieldMapperTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]AbstractQueryTestCase.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]BoolQueryBuilderTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]BoostingQueryBuilderTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]query[/\\]CommonTermsQueryBuilderTests.java" checks="LineLength" />
|
||||
@ -1071,9 +1057,6 @@
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]monitor[/\\]os[/\\]OsProbeTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]nodesinfo[/\\]NodeInfoStreamingTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]options[/\\]detailederrors[/\\]DetailedErrorsEnabledIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorQueryTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]PluginInfoTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]plugins[/\\]PluginsServiceTests.java" checks="LineLength" />
|
||||
<suppress files="core[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]recovery[/\\]FullRollingRestartIT.java" checks="LineLength" />
|
||||
@ -1222,6 +1205,16 @@
|
||||
<suppress files="modules[/\\]lang-mustache[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]messy[/\\]tests[/\\]package-info.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-mustache[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]mustache[/\\]MustacheScriptEngineTests.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]lang-mustache[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]script[/\\]mustache[/\\]MustacheTests.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolateRequest.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolateRequestBuilder.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolateShardResponse.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]TransportShardMultiPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]RestPercolateAction.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]PercolatorIT.java" checks="LineLength" />
|
||||
<suppress files="modules[/\\]percolator[/\\]src[/\\]test[/\\]java[/\\]org[/\\]elasticsearch[/\\]percolator[/\\]MultiPercolatorRequestTests.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-icu[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]IcuCollationTokenFilterFactory.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-icu[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]IcuFoldingTokenFilterFactory.java" checks="LineLength" />
|
||||
<suppress files="plugins[/\\]analysis-icu[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]index[/\\]analysis[/\\]IcuNormalizerTokenFilterFactory.java" checks="LineLength" />
|
||||
@ -1309,6 +1302,7 @@
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]cli[/\\]CliToolTestCase.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]common[/\\]util[/\\]MockBigArrays.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]search[/\\]aggregations[/\\]bucket[/\\]script[/\\]NativeSignificanceScoreScriptWithParams.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]AbstractQueryTestCase.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]BackgroundIndexer.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]CompositeTestCluster.java" checks="LineLength" />
|
||||
<suppress files="test[/\\]framework[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]test[/\\]CorruptionUtils.java" checks="LineLength" />
|
||||
|
@ -21,7 +21,6 @@ package org.elasticsearch;
|
||||
|
||||
import org.elasticsearch.action.support.replication.ReplicationOperation;
|
||||
import org.elasticsearch.cluster.action.shard.ShardStateAction;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
@ -681,8 +680,6 @@ public class ElasticsearchException extends RuntimeException implements ToXConte
|
||||
org.elasticsearch.index.shard.IndexShardRecoveryException::new, 106),
|
||||
REPOSITORY_MISSING_EXCEPTION(org.elasticsearch.repositories.RepositoryMissingException.class,
|
||||
org.elasticsearch.repositories.RepositoryMissingException::new, 107),
|
||||
PERCOLATOR_EXCEPTION(org.elasticsearch.index.percolator.PercolatorException.class,
|
||||
org.elasticsearch.index.percolator.PercolatorException::new, 108),
|
||||
DOCUMENT_SOURCE_MISSING_EXCEPTION(org.elasticsearch.index.engine.DocumentSourceMissingException.class,
|
||||
org.elasticsearch.index.engine.DocumentSourceMissingException::new, 109),
|
||||
FLUSH_NOT_ALLOWED_ENGINE_EXCEPTION(org.elasticsearch.index.engine.FlushNotAllowedEngineException.class,
|
||||
|
@ -165,10 +165,6 @@ import org.elasticsearch.action.ingest.SimulatePipelineAction;
|
||||
import org.elasticsearch.action.ingest.SimulatePipelineTransportAction;
|
||||
import org.elasticsearch.action.main.MainAction;
|
||||
import org.elasticsearch.action.main.TransportMainAction;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateAction;
|
||||
import org.elasticsearch.action.percolate.PercolateAction;
|
||||
import org.elasticsearch.action.percolate.TransportMultiPercolateAction;
|
||||
import org.elasticsearch.action.percolate.TransportPercolateAction;
|
||||
import org.elasticsearch.action.search.ClearScrollAction;
|
||||
import org.elasticsearch.action.search.MultiSearchAction;
|
||||
import org.elasticsearch.action.search.SearchAction;
|
||||
@ -332,8 +328,6 @@ public class ActionModule extends AbstractModule {
|
||||
registerAction(SearchAction.INSTANCE, TransportSearchAction.class);
|
||||
registerAction(SearchScrollAction.INSTANCE, TransportSearchScrollAction.class);
|
||||
registerAction(MultiSearchAction.INSTANCE, TransportMultiSearchAction.class);
|
||||
registerAction(PercolateAction.INSTANCE, TransportPercolateAction.class);
|
||||
registerAction(MultiPercolateAction.INSTANCE, TransportMultiPercolateAction.class);
|
||||
registerAction(ExplainAction.INSTANCE, TransportExplainAction.class);
|
||||
registerAction(ClearScrollAction.INSTANCE, TransportClearScrollAction.class);
|
||||
registerAction(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
|
||||
|
@ -42,12 +42,6 @@ import org.elasticsearch.action.get.MultiGetResponse;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateRequest;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateResponse;
|
||||
import org.elasticsearch.action.percolate.PercolateRequest;
|
||||
import org.elasticsearch.action.percolate.PercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.ClearScrollRequest;
|
||||
import org.elasticsearch.action.search.ClearScrollRequestBuilder;
|
||||
import org.elasticsearch.action.search.ClearScrollResponse;
|
||||
@ -419,36 +413,6 @@ public interface Client extends ElasticsearchClient, Releasable {
|
||||
*/
|
||||
MultiTermVectorsRequestBuilder prepareMultiTermVectors();
|
||||
|
||||
/**
|
||||
* Percolates a request returning the matches documents.
|
||||
*/
|
||||
ActionFuture<PercolateResponse> percolate(PercolateRequest request);
|
||||
|
||||
/**
|
||||
* Percolates a request returning the matches documents.
|
||||
*/
|
||||
void percolate(PercolateRequest request, ActionListener<PercolateResponse> listener);
|
||||
|
||||
/**
|
||||
* Percolates a request returning the matches documents.
|
||||
*/
|
||||
PercolateRequestBuilder preparePercolate();
|
||||
|
||||
/**
|
||||
* Performs multiple percolate requests.
|
||||
*/
|
||||
ActionFuture<MultiPercolateResponse> multiPercolate(MultiPercolateRequest request);
|
||||
|
||||
/**
|
||||
* Performs multiple percolate requests.
|
||||
*/
|
||||
void multiPercolate(MultiPercolateRequest request, ActionListener<MultiPercolateResponse> listener);
|
||||
|
||||
/**
|
||||
* Performs multiple percolate requests.
|
||||
*/
|
||||
MultiPercolateRequestBuilder prepareMultiPercolate();
|
||||
|
||||
/**
|
||||
* Computes a score explanation for the specified request.
|
||||
*
|
||||
|
@ -295,14 +295,6 @@ import org.elasticsearch.action.ingest.SimulatePipelineRequest;
|
||||
import org.elasticsearch.action.ingest.SimulatePipelineRequestBuilder;
|
||||
import org.elasticsearch.action.ingest.SimulatePipelineResponse;
|
||||
import org.elasticsearch.action.ingest.WritePipelineResponse;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateAction;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateRequest;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateResponse;
|
||||
import org.elasticsearch.action.percolate.PercolateAction;
|
||||
import org.elasticsearch.action.percolate.PercolateRequest;
|
||||
import org.elasticsearch.action.percolate.PercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.ClearScrollAction;
|
||||
import org.elasticsearch.action.search.ClearScrollRequest;
|
||||
import org.elasticsearch.action.search.ClearScrollRequestBuilder;
|
||||
@ -623,36 +615,6 @@ public abstract class AbstractClient extends AbstractComponent implements Client
|
||||
return new MultiTermVectorsRequestBuilder(this, MultiTermVectorsAction.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<PercolateResponse> percolate(final PercolateRequest request) {
|
||||
return execute(PercolateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void percolate(final PercolateRequest request, final ActionListener<PercolateResponse> listener) {
|
||||
execute(PercolateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PercolateRequestBuilder preparePercolate() {
|
||||
return new PercolateRequestBuilder(this, PercolateAction.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MultiPercolateRequestBuilder prepareMultiPercolate() {
|
||||
return new MultiPercolateRequestBuilder(this, MultiPercolateAction.INSTANCE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiPercolate(MultiPercolateRequest request, ActionListener<MultiPercolateResponse> listener) {
|
||||
execute(MultiPercolateAction.INSTANCE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<MultiPercolateResponse> multiPercolate(MultiPercolateRequest request) {
|
||||
return execute(MultiPercolateAction.INSTANCE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExplainRequestBuilder prepareExplain(String index, String type, String id) {
|
||||
return new ExplainRequestBuilder(this, ExplainAction.INSTANCE, index, type, id);
|
||||
|
@ -42,7 +42,6 @@ import org.elasticsearch.index.IndexService;
|
||||
import org.elasticsearch.index.NodeServicesProvider;
|
||||
import org.elasticsearch.index.mapper.DocumentMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.percolator.PercolatorFieldMapper;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.indices.InvalidTypeNameException;
|
||||
|
||||
|
@ -20,9 +20,7 @@
|
||||
package org.elasticsearch.common.network;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.elasticsearch.action.support.replication.ReplicationTask;
|
||||
import org.elasticsearch.client.transport.TransportClientNodesService;
|
||||
@ -36,7 +34,6 @@ import org.elasticsearch.cluster.routing.allocation.command.AllocationCommandReg
|
||||
import org.elasticsearch.cluster.routing.allocation.command.CancelAllocationCommand;
|
||||
import org.elasticsearch.cluster.routing.allocation.command.MoveAllocationCommand;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
|
||||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
@ -137,8 +134,6 @@ import org.elasticsearch.rest.action.ingest.RestGetPipelineAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestPutPipelineAction;
|
||||
import org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction;
|
||||
import org.elasticsearch.rest.action.main.RestMainAction;
|
||||
import org.elasticsearch.rest.action.percolate.RestMultiPercolateAction;
|
||||
import org.elasticsearch.rest.action.percolate.RestPercolateAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestDeleteStoredScriptAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestGetStoredScriptAction;
|
||||
import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestPutStoredScriptAction;
|
||||
@ -250,8 +245,6 @@ public class NetworkModule extends AbstractModule {
|
||||
RestMultiTermVectorsAction.class,
|
||||
RestBulkAction.class,
|
||||
RestUpdateAction.class,
|
||||
RestPercolateAction.class,
|
||||
RestMultiPercolateAction.class,
|
||||
|
||||
RestSearchAction.class,
|
||||
RestSearchScrollAction.class,
|
||||
|
@ -36,7 +36,6 @@ import org.elasticsearch.index.engine.EngineConfig;
|
||||
import org.elasticsearch.index.fielddata.IndexFieldDataService;
|
||||
import org.elasticsearch.index.mapper.FieldMapper;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.percolator.PercolatorFieldMapper;
|
||||
import org.elasticsearch.index.similarity.SimilarityService;
|
||||
import org.elasticsearch.index.store.FsDirectoryService;
|
||||
import org.elasticsearch.index.store.IndexStore;
|
||||
@ -127,7 +126,6 @@ public final class IndexScopedSettings extends AbstractScopedSettings {
|
||||
FieldMapper.IGNORE_MALFORMED_SETTING,
|
||||
FieldMapper.COERCE_SETTING,
|
||||
Store.INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING,
|
||||
PercolatorFieldMapper.INDEX_MAP_UNMAPPED_FIELDS_AS_STRING_SETTING,
|
||||
MapperService.INDEX_MAPPER_DYNAMIC_SETTING,
|
||||
MapperService.INDEX_MAPPING_NESTED_FIELDS_LIMIT_SETTING,
|
||||
MapperService.INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING,
|
||||
|
@ -23,7 +23,6 @@ import com.carrotsearch.hppc.ObjectHashSet;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
import org.apache.lucene.analysis.DelegatingAnalyzerWrapper;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
import org.elasticsearch.ElasticsearchGenerationException;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.compress.CompressedXContent;
|
||||
@ -35,15 +34,12 @@ import org.elasticsearch.index.IndexSettings;
|
||||
import org.elasticsearch.index.analysis.AnalysisService;
|
||||
import org.elasticsearch.index.mapper.Mapper.BuilderContext;
|
||||
import org.elasticsearch.index.mapper.object.ObjectMapper;
|
||||
import org.elasticsearch.index.percolator.PercolatorFieldMapper;
|
||||
import org.elasticsearch.index.query.QueryShardContext;
|
||||
import org.elasticsearch.index.similarity.SimilarityService;
|
||||
import org.elasticsearch.indices.InvalidTypeNameException;
|
||||
import org.elasticsearch.indices.TypeMissingException;
|
||||
import org.elasticsearch.indices.mapper.MapperRegistry;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -97,6 +93,8 @@ public class MapperService extends AbstractIndexComponent {
|
||||
"_uid", "_id", "_type", "_all", "_parent", "_routing", "_index",
|
||||
"_size", "_timestamp", "_ttl"
|
||||
);
|
||||
@Deprecated
|
||||
public static final String PERCOLATOR_LEGACY_TYPE_NAME = ".percolator";
|
||||
|
||||
private final AnalysisService analysisService;
|
||||
|
||||
@ -269,7 +267,6 @@ public class MapperService extends AbstractIndexComponent {
|
||||
checkNestedFieldsLimit(fullPathObjectMappers);
|
||||
checkTotalFieldsLimit(objectMappers.size() + fieldMappers.size());
|
||||
checkDepthLimit(fullPathObjectMappers.keySet());
|
||||
checkPercolatorFieldLimit(fieldTypes);
|
||||
}
|
||||
|
||||
Set<String> parentTypes = this.parentTypes;
|
||||
@ -321,7 +318,7 @@ public class MapperService extends AbstractIndexComponent {
|
||||
private boolean typeNameStartsWithIllegalDot(DocumentMapper mapper) {
|
||||
boolean legacyIndex = getIndexSettings().getIndexVersionCreated().before(Version.V_5_0_0_alpha1);
|
||||
if (legacyIndex) {
|
||||
return mapper.type().startsWith(".") && !PercolatorFieldMapper.LEGACY_TYPE_NAME.equals(mapper.type());
|
||||
return mapper.type().startsWith(".") && !PERCOLATOR_LEGACY_TYPE_NAME.equals(mapper.type());
|
||||
} else {
|
||||
return mapper.type().startsWith(".");
|
||||
}
|
||||
@ -432,25 +429,6 @@ public class MapperService extends AbstractIndexComponent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* We only allow upto 1 percolator field per index.
|
||||
*
|
||||
* Reasoning here is that the PercolatorQueryCache only supports a single document having a percolator query.
|
||||
* Also specifying multiple queries per document feels like an anti pattern
|
||||
*/
|
||||
private void checkPercolatorFieldLimit(Iterable<MappedFieldType> fieldTypes) {
|
||||
List<String> percolatorFieldTypes = new ArrayList<>();
|
||||
for (MappedFieldType fieldType : fieldTypes) {
|
||||
if (fieldType instanceof PercolatorFieldMapper.PercolatorFieldType) {
|
||||
percolatorFieldTypes.add(fieldType.name());
|
||||
}
|
||||
}
|
||||
if (percolatorFieldTypes.size() > 1) {
|
||||
throw new IllegalArgumentException("Up to one percolator field type is allowed per index, " +
|
||||
"found the following percolator fields [" + percolatorFieldTypes + "]");
|
||||
}
|
||||
}
|
||||
|
||||
public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException {
|
||||
return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null);
|
||||
}
|
||||
|
@ -839,24 +839,6 @@ public abstract class QueryBuilders {
|
||||
return new ExistsQueryBuilder(name);
|
||||
}
|
||||
|
||||
public static PercolateQueryBuilder percolateQuery(String queryField, String documentType, BytesReference document) {
|
||||
return new PercolateQueryBuilder(queryField, documentType, document);
|
||||
}
|
||||
|
||||
public static PercolateQueryBuilder percolateQuery(String queryField, String documentType, String indexedDocumentIndex,
|
||||
String indexedDocumentType, String indexedDocumentId) {
|
||||
return new PercolateQueryBuilder(queryField, documentType, indexedDocumentIndex, indexedDocumentType, indexedDocumentId,
|
||||
null, null, null);
|
||||
}
|
||||
|
||||
public static PercolateQueryBuilder percolateQuery(String queryField, String documentType, String indexedDocumentIndex,
|
||||
String indexedDocumentType, String indexedDocumentId,
|
||||
String indexedDocumentRouting, String indexedDocumentPreference,
|
||||
Long indexedDocumentVersion) {
|
||||
return new PercolateQueryBuilder(queryField, documentType, indexedDocumentIndex, indexedDocumentType, indexedDocumentId,
|
||||
indexedDocumentRouting, indexedDocumentPreference, indexedDocumentVersion);
|
||||
}
|
||||
|
||||
private QueryBuilders() {
|
||||
|
||||
}
|
||||
|
@ -171,7 +171,12 @@ public class QueryShardContext extends QueryRewriteContext {
|
||||
return isFilter;
|
||||
}
|
||||
|
||||
void setIsFilter(boolean isFilter) {
|
||||
/**
|
||||
* Public for testing only!
|
||||
*
|
||||
* Sets whether we are currently parsing a filter or a query
|
||||
*/
|
||||
public void setIsFilter(boolean isFilter) {
|
||||
this.isFilter = isFilter;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,6 @@ import org.elasticsearch.index.mapper.core.KeywordFieldMapper;
|
||||
import org.elasticsearch.index.mapper.core.StringFieldMapper;
|
||||
import org.elasticsearch.index.mapper.core.TextFieldMapper;
|
||||
import org.elasticsearch.index.mapper.core.TokenCountFieldMapper;
|
||||
import org.elasticsearch.index.mapper.core.LegacyTokenCountFieldMapper;
|
||||
import org.elasticsearch.index.mapper.core.NumberFieldMapper;
|
||||
import org.elasticsearch.index.mapper.geo.GeoPointFieldMapper;
|
||||
import org.elasticsearch.index.mapper.geo.GeoShapeFieldMapper;
|
||||
@ -52,7 +51,6 @@ import org.elasticsearch.index.mapper.internal.UidFieldMapper;
|
||||
import org.elasticsearch.index.mapper.internal.VersionFieldMapper;
|
||||
import org.elasticsearch.index.mapper.ip.IpFieldMapper;
|
||||
import org.elasticsearch.index.mapper.object.ObjectMapper;
|
||||
import org.elasticsearch.index.percolator.PercolatorFieldMapper;
|
||||
import org.elasticsearch.indices.cluster.IndicesClusterStateService;
|
||||
import org.elasticsearch.indices.flush.SyncedFlushService;
|
||||
import org.elasticsearch.indices.mapper.MapperRegistry;
|
||||
@ -98,7 +96,6 @@ public class IndicesModule extends AbstractModule {
|
||||
registerMapper(ObjectMapper.NESTED_CONTENT_TYPE, new ObjectMapper.TypeParser());
|
||||
registerMapper(CompletionFieldMapper.CONTENT_TYPE, new CompletionFieldMapper.TypeParser());
|
||||
registerMapper(GeoPointFieldMapper.CONTENT_TYPE, new GeoPointFieldMapper.TypeParser());
|
||||
registerMapper(PercolatorFieldMapper.CONTENT_TYPE, new PercolatorFieldMapper.TypeParser());
|
||||
|
||||
if (ShapesAvailability.JTS_AVAILABLE && ShapesAvailability.SPATIAL4J_AVAILABLE) {
|
||||
registerMapper(GeoShapeFieldMapper.CONTENT_TYPE, new GeoShapeFieldMapper.TypeParser());
|
||||
|
@ -32,7 +32,6 @@ import org.elasticsearch.common.lucene.search.function.ScoreFunction;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ParseFieldRegistry;
|
||||
import org.elasticsearch.index.percolator.PercolatorHighlightSubFetchPhase;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.BoostingQueryBuilder;
|
||||
import org.elasticsearch.index.query.CommonTermsQueryBuilder;
|
||||
@ -61,7 +60,6 @@ import org.elasticsearch.index.query.MoreLikeThisQueryBuilder;
|
||||
import org.elasticsearch.index.query.MultiMatchQueryBuilder;
|
||||
import org.elasticsearch.index.query.NestedQueryBuilder;
|
||||
import org.elasticsearch.index.query.ParentIdQueryBuilder;
|
||||
import org.elasticsearch.index.query.PercolateQueryBuilder;
|
||||
import org.elasticsearch.index.query.PrefixQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryParser;
|
||||
@ -469,7 +467,6 @@ public class SearchModule extends AbstractModule {
|
||||
fetchSubPhaseMultibinder.addBinding().to(MatchedQueriesFetchSubPhase.class);
|
||||
fetchSubPhaseMultibinder.addBinding().to(HighlightPhase.class);
|
||||
fetchSubPhaseMultibinder.addBinding().to(ParentFieldSubFetchPhase.class);
|
||||
fetchSubPhaseMultibinder.addBinding().to(PercolatorHighlightSubFetchPhase.class);
|
||||
for (Class<? extends FetchSubPhase> clazz : fetchSubPhases) {
|
||||
fetchSubPhaseMultibinder.addBinding().to(clazz);
|
||||
}
|
||||
@ -697,7 +694,7 @@ public class SearchModule extends AbstractModule {
|
||||
registerQuery(ExistsQueryBuilder::new, ExistsQueryBuilder::fromXContent, ExistsQueryBuilder.QUERY_NAME_FIELD);
|
||||
registerQuery(MatchNoneQueryBuilder::new, MatchNoneQueryBuilder::fromXContent, MatchNoneQueryBuilder.QUERY_NAME_FIELD);
|
||||
registerQuery(ParentIdQueryBuilder::new, ParentIdQueryBuilder::fromXContent, ParentIdQueryBuilder.QUERY_NAME_FIELD);
|
||||
registerQuery(PercolateQueryBuilder::new, PercolateQueryBuilder::fromXContent, PercolateQueryBuilder.QUERY_NAME_FIELD);
|
||||
|
||||
if (ShapesAvailability.JTS_AVAILABLE && ShapesAvailability.SPATIAL4J_AVAILABLE) {
|
||||
registerQuery(GeoShapeQueryBuilder::new, GeoShapeQueryBuilder::fromXContent, GeoShapeQueryBuilder.QUERY_NAME_FIELD);
|
||||
}
|
||||
|
@ -743,7 +743,7 @@ public class ExceptionSerializationTests extends ESTestCase {
|
||||
ids.put(105, org.elasticsearch.cluster.routing.RoutingException.class);
|
||||
ids.put(106, org.elasticsearch.index.shard.IndexShardRecoveryException.class);
|
||||
ids.put(107, org.elasticsearch.repositories.RepositoryMissingException.class);
|
||||
ids.put(108, org.elasticsearch.index.percolator.PercolatorException.class);
|
||||
ids.put(108, null);
|
||||
ids.put(109, org.elasticsearch.index.engine.DocumentSourceMissingException.class);
|
||||
ids.put(110, org.elasticsearch.index.engine.FlushNotAllowedEngineException.class);
|
||||
ids.put(111, org.elasticsearch.common.settings.NoClassSettingsException.class);
|
||||
|
@ -50,7 +50,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||
|
||||
|
@ -57,8 +57,8 @@ import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
|
||||
/**
|
||||
* The test case for unit testing task manager and related transport actions
|
||||
|
@ -51,7 +51,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.StreamsUtils.copyToStringFromClasspath;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -78,8 +78,8 @@ import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.object.HasToString.hasToString;
|
||||
|
@ -59,8 +59,8 @@ import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
|
@ -55,8 +55,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
public class TransportNodesActionTests extends ESTestCase {
|
||||
|
@ -65,8 +65,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import static org.elasticsearch.action.support.replication.ClusterStateCreationUtils.state;
|
||||
import static org.elasticsearch.action.support.replication.ClusterStateCreationUtils.stateWithAssignedPrimariesAndOneReplica;
|
||||
import static org.elasticsearch.action.support.replication.ClusterStateCreationUtils.stateWithNoShard;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.lessThanOrEqualTo;
|
||||
|
@ -43,7 +43,6 @@ import org.elasticsearch.cluster.routing.allocation.AllocationService;
|
||||
import org.elasticsearch.cluster.routing.allocation.RoutingAllocation;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.collect.Iterators;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
@ -86,8 +85,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.action.support.replication.ClusterStateCreationUtils.state;
|
||||
import static org.elasticsearch.action.support.replication.ClusterStateCreationUtils.stateWithActivePrimary;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.Matchers.arrayWithSize;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -60,8 +60,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
|
||||
public class TransportInstanceSingleOperationActionTests extends ESTestCase {
|
||||
|
@ -23,7 +23,6 @@ import org.elasticsearch.action.ActionRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.percolate.PercolateSourceBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
@ -40,9 +39,6 @@ import org.elasticsearch.test.ESIntegTestCase;
|
||||
import org.elasticsearch.test.ESIntegTestCase.ClusterScope;
|
||||
import org.elasticsearch.test.ESIntegTestCase.Scope;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertExists;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
@ -101,22 +97,6 @@ public class NoMasterNodeIT extends ESIntegTestCase {
|
||||
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
|
||||
);
|
||||
|
||||
PercolateSourceBuilder percolateSource = new PercolateSourceBuilder();
|
||||
percolateSource.setDoc(docBuilder().setDoc(new HashMap()));
|
||||
assertThrows(client().preparePercolate()
|
||||
.setIndices("test").setDocumentType("type1")
|
||||
.setSource(percolateSource),
|
||||
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
|
||||
);
|
||||
|
||||
percolateSource = new PercolateSourceBuilder();
|
||||
percolateSource.setDoc(docBuilder().setDoc(new HashMap()));
|
||||
assertThrows(client().preparePercolate()
|
||||
.setIndices("no_index").setDocumentType("type1")
|
||||
.setSource(percolateSource),
|
||||
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
|
||||
);
|
||||
|
||||
|
||||
assertThrows(client().admin().indices().prepareAnalyze("test", "this is a test"),
|
||||
ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE
|
||||
|
@ -56,8 +56,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.LongConsumer;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -54,7 +54,7 @@ import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.hamcrest.CoreMatchers.allOf;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -43,8 +43,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import static java.util.Collections.singleton;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.INITIALIZING;
|
||||
import static org.elasticsearch.cluster.routing.ShardRoutingState.STARTED;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
/**
|
||||
|
@ -64,7 +64,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.empty;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -58,8 +58,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static java.util.Collections.singleton;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
||||
|
@ -65,8 +65,8 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static java.util.Collections.shuffle;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
|
@ -36,7 +36,7 @@ import org.elasticsearch.cache.recycler.PageCacheRecycler;
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.cluster.service.ClusterService;
|
||||
import org.elasticsearch.cluster.service.ClusterServiceUtils;
|
||||
import org.elasticsearch.test.ClusterServiceUtils;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
import org.elasticsearch.common.settings.Setting.Property;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
@ -88,8 +88,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
|
||||
public class IndexModuleTests extends ESTestCase {
|
||||
private Index index;
|
||||
private Settings settings;
|
||||
|
@ -46,7 +46,7 @@ import java.util.Collections;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
|
||||
public class DynamicMappingDisabledTests extends ESSingleNodeTestCase {
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.index.query;
|
||||
|
||||
import com.fasterxml.jackson.core.io.JsonStringEncoder;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.queries.BoostingQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.queries.ExtendedCommonTermsQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -106,21 +107,21 @@ public class CommonTermsQueryBuilderTests extends AbstractQueryTestCase<CommonTe
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String query =
|
||||
"{\n" +
|
||||
" \"common\" : {\n" +
|
||||
" \"body\" : {\n" +
|
||||
" \"query\" : \"nelly the elephant not as a cartoon\",\n" +
|
||||
" \"disable_coord\" : true,\n" +
|
||||
" \"high_freq_operator\" : \"AND\",\n" +
|
||||
" \"low_freq_operator\" : \"OR\",\n" +
|
||||
" \"cutoff_frequency\" : 0.001,\n" +
|
||||
" \"minimum_should_match\" : {\n" +
|
||||
" \"low_freq\" : \"2\",\n" +
|
||||
" \"high_freq\" : \"3\"\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 42.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"common\" : {\n" +
|
||||
" \"body\" : {\n" +
|
||||
" \"query\" : \"nelly the elephant not as a cartoon\",\n" +
|
||||
" \"disable_coord\" : true,\n" +
|
||||
" \"high_freq_operator\" : \"AND\",\n" +
|
||||
" \"low_freq_operator\" : \"OR\",\n" +
|
||||
" \"cutoff_frequency\" : 0.001,\n" +
|
||||
" \"minimum_should_match\" : {\n" +
|
||||
" \"low_freq\" : \"2\",\n" +
|
||||
" \"high_freq\" : \"3\"\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 42.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
CommonTermsQueryBuilder queryBuilder = (CommonTermsQueryBuilder) parseQuery(query);
|
||||
@ -132,7 +133,7 @@ public class CommonTermsQueryBuilderTests extends AbstractQueryTestCase<CommonTe
|
||||
assertEquals(query, Operator.AND, queryBuilder.highFreqOperator());
|
||||
assertEquals(query, "nelly the elephant not as a cartoon", queryBuilder.value());
|
||||
}
|
||||
|
||||
|
||||
public void testNoTermsFromQueryString() throws IOException {
|
||||
CommonTermsQueryBuilder builder = new CommonTermsQueryBuilder(STRING_FIELD_NAME, "");
|
||||
QueryShardContext context = createShardContext();
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.index.query;
|
||||
import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.BoostQuery;
|
||||
import org.apache.lucene.search.DisjunctionMaxQuery;
|
||||
import org.apache.lucene.search.PrefixQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
@ -25,6 +25,7 @@ import org.apache.lucene.search.ConstantScoreQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.index.query;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.spans.FieldMaskingSpanQuery;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -77,20 +78,20 @@ public class FieldMaskingSpanQueryBuilderTests extends AbstractQueryTestCase<Fie
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"field_masking_span\" : {\n" +
|
||||
" \"query\" : {\n" +
|
||||
" \"span_term\" : {\n" +
|
||||
" \"value\" : {\n" +
|
||||
" \"value\" : 0.5,\n" +
|
||||
" \"boost\" : 0.23\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"field\" : \"mapped_geo_shape\",\n" +
|
||||
" \"boost\" : 42.0,\n" +
|
||||
" \"_name\" : \"KPI\"\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"field_masking_span\" : {\n" +
|
||||
" \"query\" : {\n" +
|
||||
" \"span_term\" : {\n" +
|
||||
" \"value\" : {\n" +
|
||||
" \"value\" : 0.5,\n" +
|
||||
" \"boost\" : 0.23\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"field\" : \"mapped_geo_shape\",\n" +
|
||||
" \"boost\" : 42.0,\n" +
|
||||
" \"_name\" : \"KPI\"\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
FieldMaskingSpanQueryBuilder parsed = (FieldMaskingSpanQueryBuilder) parseQuery(json);
|
||||
|
@ -19,21 +19,16 @@
|
||||
|
||||
package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.document.IntPoint;
|
||||
import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.BoostQuery;
|
||||
import org.apache.lucene.search.FuzzyQuery;
|
||||
import org.apache.lucene.search.LegacyNumericRangeQuery;
|
||||
import org.apache.lucene.search.PointRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
import org.elasticsearch.common.unit.Fuzziness;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.hamcrest.Matchers.either;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
@ -145,17 +140,17 @@ public class FuzzyQueryBuilderTests extends AbstractQueryTestCase<FuzzyQueryBuil
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"fuzzy\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"ki\",\n" +
|
||||
" \"fuzziness\" : \"2\",\n" +
|
||||
" \"prefix_length\" : 0,\n" +
|
||||
" \"max_expansions\" : 100,\n" +
|
||||
" \"transpositions\" : false,\n" +
|
||||
" \"boost\" : 42.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"fuzzy\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"ki\",\n" +
|
||||
" \"fuzziness\" : \"2\",\n" +
|
||||
" \"prefix_length\" : 0,\n" +
|
||||
" \"max_expansions\" : 100,\n" +
|
||||
" \"transpositions\" : false,\n" +
|
||||
" \"boost\" : 42.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
FuzzyQueryBuilder parsed = (FuzzyQueryBuilder) parseQuery(json);
|
||||
checkGeneratedJson(json, parsed);
|
||||
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.geo.GeoUtils;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.index.search.geo.InMemoryGeoBoundingBoxQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
import org.locationtech.spatial4j.io.GeohashUtils;
|
||||
import org.locationtech.spatial4j.shape.Rectangle;
|
||||
|
@ -28,6 +28,7 @@ import org.elasticsearch.common.geo.GeoDistance;
|
||||
import org.elasticsearch.common.geo.GeoPoint;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.search.geo.GeoDistanceRangeQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
import org.locationtech.spatial4j.shape.Point;
|
||||
|
||||
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.geo.GeoUtils;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.search.geo.GeoDistanceRangeQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomGeoGenerator;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -32,6 +32,7 @@ import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.search.geo.GeoPolygonQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator.ShapeType;
|
||||
import org.locationtech.spatial4j.shape.jts.JtsGeometry;
|
||||
|
@ -38,6 +38,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.index.get.GetResult;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator.ShapeType;
|
||||
import org.junit.After;
|
||||
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.index.mapper.geo.BaseGeoPointFieldMapper;
|
||||
import org.elasticsearch.index.mapper.geo.GeoPointFieldMapper;
|
||||
import org.elasticsearch.index.query.GeohashCellQuery.Builder;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.geo.RandomShapeGenerator;
|
||||
import org.locationtech.spatial4j.shape.Point;
|
||||
|
||||
|
@ -48,6 +48,8 @@ import org.elasticsearch.search.fetch.innerhits.InnerHitsContext;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -67,10 +69,9 @@ public class HasChildQueryBuilderTests extends AbstractQueryTestCase<HasChildQue
|
||||
|
||||
private static String similarity;
|
||||
|
||||
@BeforeClass
|
||||
public static void before() throws Exception {
|
||||
@Override
|
||||
protected void initializeAdditionalMappings(MapperService mapperService) throws IOException {
|
||||
similarity = randomFrom("classic", "BM25");
|
||||
MapperService mapperService = createShardContext().getMapperService();
|
||||
mapperService.merge(PARENT_TYPE, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(PARENT_TYPE,
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
STRING_FIELD_NAME_2, "type=keyword",
|
||||
|
@ -38,6 +38,8 @@ import org.elasticsearch.search.fetch.innerhits.InnerHitsContext;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -53,9 +55,8 @@ public class HasParentQueryBuilderTests extends AbstractQueryTestCase<HasParentQ
|
||||
protected static final String PARENT_TYPE = "parent";
|
||||
protected static final String CHILD_TYPE = "child";
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
MapperService mapperService = createShardContext().getMapperService();
|
||||
@Override
|
||||
protected void initializeAdditionalMappings(MapperService mapperService) throws IOException {
|
||||
mapperService.merge(PARENT_TYPE, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(PARENT_TYPE,
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
STRING_FIELD_NAME_2, "type=keyword",
|
||||
|
@ -25,6 +25,7 @@ import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -153,12 +154,12 @@ public class IdsQueryBuilderTests extends AbstractQueryTestCase<IdsQueryBuilder>
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"ids\" : {\n" +
|
||||
" \"type\" : [ \"my_type\" ],\n" +
|
||||
" \"values\" : [ \"1\", \"100\", \"4\" ],\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"ids\" : {\n" +
|
||||
" \"type\" : [ \"my_type\" ],\n" +
|
||||
" \"values\" : [ \"1\", \"100\", \"4\" ],\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
IdsQueryBuilder parsed = (IdsQueryBuilder) parseQuery(json);
|
||||
checkGeneratedJson(json, parsed);
|
||||
|
@ -20,6 +20,7 @@
|
||||
package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -77,27 +78,27 @@ public class IndicesQueryBuilderTests extends AbstractQueryTestCase<IndicesQuery
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"indices\" : {\n" +
|
||||
" \"indices\" : [ \"index1\", \"index2\" ],\n" +
|
||||
" \"query\" : {\n" +
|
||||
" \"term\" : {\n" +
|
||||
" \"tag\" : {\n" +
|
||||
" \"value\" : \"wow\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"no_match_query\" : {\n" +
|
||||
" \"term\" : {\n" +
|
||||
" \"tag\" : {\n" +
|
||||
" \"value\" : \"kow\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"indices\" : {\n" +
|
||||
" \"indices\" : [ \"index1\", \"index2\" ],\n" +
|
||||
" \"query\" : {\n" +
|
||||
" \"term\" : {\n" +
|
||||
" \"tag\" : {\n" +
|
||||
" \"value\" : \"wow\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"no_match_query\" : {\n" +
|
||||
" \"term\" : {\n" +
|
||||
" \"tag\" : {\n" +
|
||||
" \"value\" : \"kow\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
IndicesQueryBuilder parsed = (IndicesQueryBuilder) parseQuery(json);
|
||||
checkGeneratedJson(json, parsed);
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.MatchAllDocsQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -52,13 +53,13 @@ public class MatchAllQueryBuilderTests extends AbstractQueryTestCase<MatchAllQue
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"match_all\" : {\n" +
|
||||
" \"boost\" : 1.2\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"match_all\" : {\n" +
|
||||
" \"boost\" : 1.2\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
MatchAllQueryBuilder parsed = (MatchAllQueryBuilder) parseQuery(json);
|
||||
checkGeneratedJson(json, parsed);
|
||||
assertEquals(json, 1.2, parsed.boost(), 0.0001);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -40,10 +41,10 @@ public class MatchNoneQueryBuilderTests extends AbstractQueryTestCase<MatchNoneQ
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"match_none\" : {\n" +
|
||||
" \"boost\" : 1.2\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"match_none\" : {\n" +
|
||||
" \"boost\" : 1.2\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
MatchNoneQueryBuilder parsed = (MatchNoneQueryBuilder) parseQuery(json);
|
||||
checkGeneratedJson(json, parsed);
|
||||
|
@ -25,6 +25,8 @@ import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import static org.hamcrest.CoreMatchers.either;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
|
@ -25,6 +25,7 @@ import org.apache.lucene.search.PointRangeQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.index.search.MatchQuery;
|
||||
import org.elasticsearch.index.search.MatchQuery.Type;
|
||||
import org.elasticsearch.index.search.MatchQuery.ZeroTermsQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matcher;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -41,6 +41,7 @@ import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.VersionType;
|
||||
import org.elasticsearch.index.query.MoreLikeThisQueryBuilder.Item;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -304,30 +305,30 @@ public class MoreLikeThisQueryBuilderTests extends AbstractQueryTestCase<MoreLik
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
"{\n" +
|
||||
" \"more_like_this\" : {\n" +
|
||||
" \"fields\" : [ \"title\", \"description\" ],\n" +
|
||||
" \"like\" : [ \"and potentially some more text here as well\", {\n" +
|
||||
" \"_index\" : \"imdb\",\n" +
|
||||
" \"_type\" : \"movies\",\n" +
|
||||
" \"_id\" : \"1\"\n" +
|
||||
" }, {\n" +
|
||||
" \"_index\" : \"imdb\",\n" +
|
||||
" \"_type\" : \"movies\",\n" +
|
||||
" \"_id\" : \"2\"\n" +
|
||||
" } ],\n" +
|
||||
" \"max_query_terms\" : 12,\n" +
|
||||
" \"min_term_freq\" : 1,\n" +
|
||||
" \"min_doc_freq\" : 5,\n" +
|
||||
" \"max_doc_freq\" : 2147483647,\n" +
|
||||
" \"min_word_length\" : 0,\n" +
|
||||
" \"max_word_length\" : 0,\n" +
|
||||
" \"minimum_should_match\" : \"30%\",\n" +
|
||||
" \"boost_terms\" : 0.0,\n" +
|
||||
" \"include\" : false,\n" +
|
||||
" \"fail_on_unsupported_field\" : true,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" \"fields\" : [ \"title\", \"description\" ],\n" +
|
||||
" \"like\" : [ \"and potentially some more text here as well\", {\n" +
|
||||
" \"_index\" : \"imdb\",\n" +
|
||||
" \"_type\" : \"movies\",\n" +
|
||||
" \"_id\" : \"1\"\n" +
|
||||
" }, {\n" +
|
||||
" \"_index\" : \"imdb\",\n" +
|
||||
" \"_type\" : \"movies\",\n" +
|
||||
" \"_id\" : \"2\"\n" +
|
||||
" } ],\n" +
|
||||
" \"max_query_terms\" : 12,\n" +
|
||||
" \"min_term_freq\" : 1,\n" +
|
||||
" \"min_doc_freq\" : 5,\n" +
|
||||
" \"max_doc_freq\" : 2147483647,\n" +
|
||||
" \"min_word_length\" : 0,\n" +
|
||||
" \"max_word_length\" : 0,\n" +
|
||||
" \"minimum_should_match\" : \"30%\",\n" +
|
||||
" \"boost_terms\" : 0.0,\n" +
|
||||
" \"include\" : false,\n" +
|
||||
" \"fail_on_unsupported_field\" : true,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
MoreLikeThisQueryBuilder parsed = (MoreLikeThisQueryBuilder) parseQuery(json);
|
||||
|
@ -37,6 +37,7 @@ import org.elasticsearch.common.lucene.search.MatchNoDocsQuery;
|
||||
import org.elasticsearch.common.lucene.search.MultiPhrasePrefixQuery;
|
||||
import org.elasticsearch.index.query.MultiMatchQueryBuilder.Type;
|
||||
import org.elasticsearch.index.search.MatchQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
@ -36,6 +36,7 @@ import org.elasticsearch.search.fetch.innerhits.InnerHitsContext;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.search.sort.FieldSortBuilder;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
@ -49,9 +50,7 @@ import static org.hamcrest.CoreMatchers.notNullValue;
|
||||
public class NestedQueryBuilderTests extends AbstractQueryTestCase<NestedQueryBuilder> {
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
MapperService mapperService = createShardContext().getMapperService();
|
||||
protected void initializeAdditionalMappings(MapperService mapperService) throws IOException {
|
||||
mapperService.merge("nested_doc", new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef("nested_doc",
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
INT_FIELD_NAME, "type=integer",
|
||||
|
@ -28,6 +28,7 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
||||
import org.elasticsearch.common.compress.CompressedXContent;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.mapper.internal.TypeFieldMapper;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -42,25 +43,23 @@ public class ParentIdQueryBuilderTests extends AbstractQueryTestCase<ParentIdQue
|
||||
protected static final String CHILD_TYPE = "child";
|
||||
|
||||
@Override
|
||||
public void setUp() throws Exception {
|
||||
super.setUp();
|
||||
MapperService mapperService = createShardContext().getMapperService();
|
||||
protected void initializeAdditionalMappings(MapperService mapperService) throws IOException {
|
||||
mapperService.merge(PARENT_TYPE, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(PARENT_TYPE,
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
INT_FIELD_NAME, "type=integer",
|
||||
DOUBLE_FIELD_NAME, "type=double",
|
||||
BOOLEAN_FIELD_NAME, "type=boolean",
|
||||
DATE_FIELD_NAME, "type=date",
|
||||
OBJECT_FIELD_NAME, "type=object"
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
INT_FIELD_NAME, "type=integer",
|
||||
DOUBLE_FIELD_NAME, "type=double",
|
||||
BOOLEAN_FIELD_NAME, "type=boolean",
|
||||
DATE_FIELD_NAME, "type=date",
|
||||
OBJECT_FIELD_NAME, "type=object"
|
||||
).string()), MapperService.MergeReason.MAPPING_UPDATE, false);
|
||||
mapperService.merge(CHILD_TYPE, new CompressedXContent(PutMappingRequest.buildFromSimplifiedDef(CHILD_TYPE,
|
||||
"_parent", "type=" + PARENT_TYPE,
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
INT_FIELD_NAME, "type=integer",
|
||||
DOUBLE_FIELD_NAME, "type=double",
|
||||
BOOLEAN_FIELD_NAME, "type=boolean",
|
||||
DATE_FIELD_NAME, "type=date",
|
||||
OBJECT_FIELD_NAME, "type=object"
|
||||
"_parent", "type=" + PARENT_TYPE,
|
||||
STRING_FIELD_NAME, "type=text",
|
||||
INT_FIELD_NAME, "type=integer",
|
||||
DOUBLE_FIELD_NAME, "type=double",
|
||||
BOOLEAN_FIELD_NAME, "type=boolean",
|
||||
DATE_FIELD_NAME, "type=date",
|
||||
OBJECT_FIELD_NAME, "type=object"
|
||||
).string()), MapperService.MergeReason.MAPPING_UPDATE, false);
|
||||
}
|
||||
|
||||
|
@ -23,12 +23,11 @@ import org.apache.lucene.index.Term;
|
||||
import org.apache.lucene.search.MultiTermQuery;
|
||||
import org.apache.lucene.search.PrefixQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.prefixQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.queryStringQuery;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
|
@ -38,6 +38,7 @@ import org.apache.lucene.search.MultiTermQuery;
|
||||
import org.apache.lucene.util.automaton.TooComplexToDeterminizeException;
|
||||
import org.elasticsearch.common.lucene.all.AllTermQuery;
|
||||
import org.elasticsearch.common.unit.Fuzziness;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.joda.time.DateTimeZone;
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomInts;
|
||||
import com.carrotsearch.randomizedtesting.generators.RandomStrings;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -30,6 +30,7 @@ import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.common.lucene.BytesRefs;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType;
|
||||
import org.elasticsearch.index.mapper.MappedFieldType.Relation;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.chrono.ISOChronology;
|
||||
|
@ -21,12 +21,12 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.RegexpQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.prefixQuery;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
@ -85,15 +85,15 @@ public class RegexpQueryBuilderTests extends AbstractQueryTestCase<RegexpQueryBu
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"regexp\" : {\n" +
|
||||
" \"name.first\" : {\n" +
|
||||
" \"value\" : \"s.*y\",\n" +
|
||||
" \"flags_value\" : 7,\n" +
|
||||
" \"max_determinized_states\" : 20000,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"regexp\" : {\n" +
|
||||
" \"name.first\" : {\n" +
|
||||
" \"value\" : \"s.*y\",\n" +
|
||||
" \"flags_value\" : 7,\n" +
|
||||
" \"max_determinized_states\" : 20000,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
RegexpQueryBuilder parsed = (RegexpQueryBuilder) parseQuery(json);
|
||||
|
@ -23,6 +23,7 @@ import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.script.MockScriptEngine;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -49,16 +50,16 @@ public class ScriptQueryBuilderTests extends AbstractQueryTestCase<ScriptQueryBu
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"script\" : {\n" +
|
||||
" \"script\" : {\n" +
|
||||
" \"inline\" : \"5\",\n" +
|
||||
" \"lang\" : \"mockscript\",\n" +
|
||||
" \"params\" : { }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0,\n" +
|
||||
" \"_name\" : \"PcKdEyPOmR\"\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"script\" : {\n" +
|
||||
" \"script\" : {\n" +
|
||||
" \"inline\" : \"5\",\n" +
|
||||
" \"lang\" : \"mockscript\",\n" +
|
||||
" \"params\" : { }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0,\n" +
|
||||
" \"_name\" : \"PcKdEyPOmR\"\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
ScriptQueryBuilder parsed = (ScriptQueryBuilder) parseQuery(json);
|
||||
|
@ -28,6 +28,7 @@ import org.apache.lucene.search.MatchNoDocsQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.TermQuery;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.spans.SpanContainingQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.spans.SpanFirstQuery;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -81,19 +82,19 @@ public class SpanFirstQueryBuilderTests extends AbstractQueryTestCase<SpanFirstQ
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"span_first\" : {\n" +
|
||||
" \"match\" : {\n" +
|
||||
" \"span_term\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"kimchy\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"end\" : 3,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"span_first\" : {\n" +
|
||||
" \"match\" : {\n" +
|
||||
" \"span_term\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"kimchy\",\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"end\" : 3,\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
SpanFirstQueryBuilder parsed = (SpanFirstQueryBuilder) parseQuery(json);
|
||||
|
@ -25,6 +25,7 @@ import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.spans.SpanBoostQuery;
|
||||
import org.apache.lucene.search.spans.SpanMultiTermQueryWrapper;
|
||||
import org.apache.lucene.search.spans.SpanQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -90,18 +91,18 @@ public class SpanMultiTermQueryBuilderTests extends AbstractQueryTestCase<SpanMu
|
||||
|
||||
public void testFromJson() throws IOException {
|
||||
String json =
|
||||
"{\n" +
|
||||
" \"span_multi\" : {\n" +
|
||||
" \"match\" : {\n" +
|
||||
" \"prefix\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"ki\",\n" +
|
||||
" \"boost\" : 1.08\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"{\n" +
|
||||
" \"span_multi\" : {\n" +
|
||||
" \"match\" : {\n" +
|
||||
" \"prefix\" : {\n" +
|
||||
" \"user\" : {\n" +
|
||||
" \"value\" : \"ki\",\n" +
|
||||
" \"boost\" : 1.08\n" +
|
||||
" }\n" +
|
||||
" }\n" +
|
||||
" },\n" +
|
||||
" \"boost\" : 1.0\n" +
|
||||
" }\n" +
|
||||
"}";
|
||||
|
||||
SpanMultiTermQueryBuilder parsed = (SpanMultiTermQueryBuilder) parseQuery(json);
|
||||
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.spans.SpanNearQuery;
|
||||
import org.apache.lucene.search.spans.SpanQuery;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.common.ParseFieldMatcher;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -24,6 +24,7 @@ import org.apache.lucene.search.spans.SpanNotQuery;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -22,6 +22,7 @@ package org.elasticsearch.index.query;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.spans.SpanOrQuery;
|
||||
import org.apache.lucene.search.spans.SpanQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.spans.SpanWithinQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -28,7 +28,8 @@ import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.script.Script.ScriptParseException;
|
||||
import org.elasticsearch.script.ScriptService.ScriptType;
|
||||
import org.elasticsearch.script.Template;
|
||||
import org.junit.BeforeClass;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@ -40,10 +41,10 @@ public class TemplateQueryBuilderTests extends AbstractQueryTestCase<TemplateQue
|
||||
/**
|
||||
* The query type all template tests will be based on.
|
||||
*/
|
||||
private static QueryBuilder templateBase;
|
||||
private QueryBuilder templateBase;
|
||||
|
||||
@BeforeClass
|
||||
public static void setupClass() {
|
||||
@Before
|
||||
public void before() {
|
||||
templateBase = RandomQueryBuilder.createQuery(random());
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.get.GetResult;
|
||||
import org.elasticsearch.indices.TermsLookup;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
|
||||
@ -45,7 +46,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.prefixQuery;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
@ -23,6 +23,7 @@ import org.apache.lucene.search.MatchNoDocsQuery;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.index.mapper.internal.TypeFieldMapper;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -21,6 +21,7 @@ package org.elasticsearch.index.query;
|
||||
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.WildcardQuery;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import org.elasticsearch.action.support.ToXContentToBytes;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
|
@ -36,8 +36,11 @@ import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery;
|
||||
import org.elasticsearch.common.lucene.search.function.WeightFactorFunction;
|
||||
import org.elasticsearch.common.unit.DistanceUnit;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.mapper.MapperService;
|
||||
import org.elasticsearch.index.query.AbstractQueryBuilder;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.search.SearchModule;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.MatchAllQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
@ -53,9 +56,11 @@ import org.elasticsearch.search.MultiValueMode;
|
||||
import org.hamcrest.Matcher;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
@ -74,10 +79,10 @@ import static org.hamcrest.Matchers.instanceOf;
|
||||
import static org.hamcrest.Matchers.nullValue;
|
||||
|
||||
public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<FunctionScoreQueryBuilder> {
|
||||
@BeforeClass
|
||||
public static void registerTestRandomScoreFunction() {
|
||||
getSearchModule().registerScoreFunction(RandomScoreFunctionBuilderWithFixedSeed::new,
|
||||
RandomScoreFunctionBuilderWithFixedSeed::fromXContent, RandomScoreFunctionBuilderWithFixedSeed.FUNCTION_NAME_FIELD);
|
||||
|
||||
@Override
|
||||
protected Collection<Class<? extends Plugin>> getPlugins() {
|
||||
return Collections.singleton(TestPlugin.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -731,4 +736,23 @@ public class FunctionScoreQueryBuilderTests extends AbstractQueryTestCase<Functi
|
||||
return replacement;
|
||||
}
|
||||
}
|
||||
|
||||
public static class TestPlugin extends Plugin {
|
||||
|
||||
@Override
|
||||
public String name() {
|
||||
return "test-plugin";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Adds random function with fixed seed";
|
||||
}
|
||||
|
||||
public void onModule(SearchModule module) {
|
||||
module.registerScoreFunction(RandomScoreFunctionBuilderWithFixedSeed::new,
|
||||
RandomScoreFunctionBuilderWithFixedSeed::fromXContent, RandomScoreFunctionBuilderWithFixedSeed.FUNCTION_NAME_FIELD);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,10 +36,6 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequestBui
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.MultiPercolateResponse;
|
||||
import org.elasticsearch.action.percolate.PercolateRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.PercolateSourceBuilder;
|
||||
import org.elasticsearch.action.search.MultiSearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.MultiSearchResponse;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
@ -57,7 +53,6 @@ import org.elasticsearch.test.ESIntegTestCase;
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static org.elasticsearch.action.percolate.PercolateSourceBuilder.docBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
@ -75,7 +70,7 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
}
|
||||
|
||||
public void testSpecifiedIndexUnavailableMultipleIndices() throws Exception {
|
||||
assertAcked(prepareCreate("test1").addMapping("query", "query", "type=percolator"));
|
||||
assertAcked(prepareCreate("test1"));
|
||||
ensureYellow();
|
||||
|
||||
// Verify defaults
|
||||
@ -90,8 +85,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1", "test2"), true);
|
||||
verify(aliasExists("test1", "test2"), true);
|
||||
verify(typesExists("test1", "test2"), true);
|
||||
verify(percolate("test1", "test2"), true);
|
||||
verify(mpercolate(null, "test1", "test2"), false);
|
||||
verify(getAliases("test1", "test2"), true);
|
||||
verify(getFieldMapping("test1", "test2"), true);
|
||||
verify(getMapping("test1", "test2"), true);
|
||||
@ -109,8 +102,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(percolate("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), true);
|
||||
@ -128,15 +119,13 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(percolate("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getSettings("test1", "test2").setIndicesOptions(options), false);
|
||||
|
||||
options = IndicesOptions.strictExpandOpen();
|
||||
assertAcked(prepareCreate("test2").addMapping("query", "query", "type=percolator"));
|
||||
assertAcked(prepareCreate("test2"));
|
||||
ensureYellow();
|
||||
verify(search("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(msearch(options, "test1", "test2").setIndicesOptions(options), false);
|
||||
@ -149,8 +138,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(percolate("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, "test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1", "test2").setIndicesOptions(options), false);
|
||||
@ -158,7 +145,7 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
}
|
||||
|
||||
public void testSpecifiedIndexUnavailableSingleIndexThatIsClosed() throws Exception {
|
||||
assertAcked(prepareCreate("test1").addMapping("query", "query", "type=percolator"));
|
||||
assertAcked(prepareCreate("test1"));
|
||||
// we need to wait until all shards are allocated since recovery from
|
||||
// gateway will fail unless the majority of the replicas was allocated
|
||||
// pre-closing. with lots of replicas this will fail.
|
||||
@ -178,8 +165,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1").setIndicesOptions(options), true);
|
||||
verify(percolate("test1").setIndicesOptions(options), true);
|
||||
verify(mpercolate(options, "test1").setIndicesOptions(options), true);
|
||||
verify(getAliases("test1").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1").setIndicesOptions(options), true);
|
||||
@ -197,8 +182,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(percolate("test1").setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, "test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
@ -219,8 +202,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(percolate("test1").setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, "test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
@ -240,7 +221,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), true);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), true);
|
||||
verify(typesExists("test1").setIndicesOptions(options), true);
|
||||
verify(percolate("test1").setIndicesOptions(options), true);
|
||||
verify(getAliases("test1").setIndicesOptions(options), true);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), true);
|
||||
verify(getMapping("test1").setIndicesOptions(options), true);
|
||||
@ -258,13 +238,12 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(percolate("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getSettings("test1").setIndicesOptions(options), false);
|
||||
|
||||
assertAcked(prepareCreate("test1").addMapping("query", "query", "type=percolator"));
|
||||
assertAcked(prepareCreate("test1"));
|
||||
ensureYellow();
|
||||
|
||||
options = IndicesOptions.strictExpandOpenAndForbidClosed();
|
||||
@ -279,7 +258,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery("test1").setIndicesOptions(options), false);
|
||||
verify(aliasExists("test1").setIndicesOptions(options), false);
|
||||
verify(typesExists("test1").setIndicesOptions(options), false);
|
||||
verify(percolate("test1").setIndicesOptions(options), false);
|
||||
verify(getAliases("test1").setIndicesOptions(options), false);
|
||||
verify(getFieldMapping("test1").setIndicesOptions(options), false);
|
||||
verify(getMapping("test1").setIndicesOptions(options), false);
|
||||
@ -330,8 +308,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery(indices), true);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(percolate(indices), false);
|
||||
verify(mpercolate(null, indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
@ -350,14 +326,12 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery(indices).setIndicesOptions(options), false);
|
||||
verify(aliasExists(indices).setIndicesOptions(options), false);
|
||||
verify(typesExists(indices).setIndicesOptions(options), false);
|
||||
verify(percolate(indices).setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, indices), false);
|
||||
verify(getAliases(indices).setIndicesOptions(options), false);
|
||||
verify(getFieldMapping(indices).setIndicesOptions(options), false);
|
||||
verify(getMapping(indices).setIndicesOptions(options), false);
|
||||
verify(getSettings(indices).setIndicesOptions(options), false);
|
||||
|
||||
assertAcked(prepareCreate("foobar").addMapping("query", "query", "type=percolator"));
|
||||
assertAcked(prepareCreate("foobar"));
|
||||
client().prepareIndex("foobar", "type", "1").setSource("k", "v").setRefresh(true).execute().actionGet();
|
||||
|
||||
// Verify defaults for wildcards, with one wildcard expression and one existing index
|
||||
@ -373,8 +347,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery(indices), false);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(percolate(indices), false);
|
||||
verify(mpercolate(null, indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
@ -393,8 +365,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery(indices), true);
|
||||
verify(aliasExists(indices), false);
|
||||
verify(typesExists(indices), false);
|
||||
verify(percolate(indices), false);
|
||||
verify(mpercolate(null, indices), false);
|
||||
verify(getAliases(indices), false);
|
||||
verify(getFieldMapping(indices), false);
|
||||
verify(getMapping(indices), false);
|
||||
@ -413,8 +383,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
verify(validateQuery(indices).setIndicesOptions(options), false);
|
||||
verify(aliasExists(indices).setIndicesOptions(options), false);
|
||||
verify(typesExists(indices).setIndicesOptions(options), false);
|
||||
verify(percolate(indices).setIndicesOptions(options), false);
|
||||
verify(mpercolate(options, indices), false);
|
||||
verify(getAliases(indices).setIndicesOptions(options), false);
|
||||
verify(getFieldMapping(indices).setIndicesOptions(options), false);
|
||||
verify(getMapping(indices).setIndicesOptions(options), false);
|
||||
@ -724,20 +692,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
return client().admin().indices().prepareTypesExists(indices).setTypes("dummy");
|
||||
}
|
||||
|
||||
private static PercolateRequestBuilder percolate(String... indices) {
|
||||
return client().preparePercolate().setIndices(indices)
|
||||
.setSource(new PercolateSourceBuilder().setDoc(docBuilder().setDoc("k", "v")))
|
||||
.setDocumentType("type");
|
||||
}
|
||||
|
||||
private static MultiPercolateRequestBuilder mpercolate(IndicesOptions options, String... indices) {
|
||||
MultiPercolateRequestBuilder builder = client().prepareMultiPercolate();
|
||||
if (options != null) {
|
||||
builder.setIndicesOptions(options);
|
||||
}
|
||||
return builder.add(percolate(indices));
|
||||
}
|
||||
|
||||
private static GetAliasesRequestBuilder getAliases(String... indices) {
|
||||
return client().admin().indices().prepareGetAliases("dummy").addIndices(indices);
|
||||
}
|
||||
@ -776,11 +730,6 @@ public class IndicesOptionsIntegrationIT extends ESIntegTestCase {
|
||||
assertThat(multiSearchResponse.getResponses().length, equalTo(1));
|
||||
assertThat(multiSearchResponse.getResponses()[0].isFailure(), is(true));
|
||||
assertThat(multiSearchResponse.getResponses()[0].getResponse(), nullValue());
|
||||
} else if (requestBuilder instanceof MultiPercolateRequestBuilder) {
|
||||
MultiPercolateResponse multiPercolateResponse = ((MultiPercolateRequestBuilder) requestBuilder).get();
|
||||
assertThat(multiPercolateResponse.getItems().length, equalTo(1));
|
||||
assertThat(multiPercolateResponse.getItems()[0].isFailure(), is(true));
|
||||
assertThat(multiPercolateResponse.getItems()[0].getResponse(), nullValue());
|
||||
} else {
|
||||
try {
|
||||
requestBuilder.get();
|
||||
|
@ -50,7 +50,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.elasticsearch.Version.CURRENT;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.VersionUtils.randomVersion;
|
||||
|
||||
/**
|
||||
|
@ -143,7 +143,6 @@ public class SearchModuleTests extends ModuleTestCase {
|
||||
"multi_match",
|
||||
"nested",
|
||||
"parent_id",
|
||||
"percolate",
|
||||
"prefix",
|
||||
"query_string",
|
||||
"range",
|
||||
|
@ -40,7 +40,7 @@ import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.EnvironmentModule;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.indices.IndicesModule;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
@ -74,8 +74,8 @@ import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
|
||||
public class AggregatorParsingTests extends ESTestCase {
|
||||
|
@ -44,7 +44,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.EnvironmentModule;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.indices.IndicesModule;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
@ -75,8 +75,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public abstract class BaseAggregationTestCase<AB extends AggregationBuilder<AB>> extends ESTestCase {
|
||||
|
@ -44,7 +44,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.EnvironmentModule;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.indices.IndicesModule;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
@ -76,8 +76,8 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public abstract class BasePipelineAggregationTestCase<AF extends PipelineAggregatorBuilder> extends ESTestCase {
|
||||
|
@ -21,7 +21,7 @@ package org.elasticsearch.search.aggregations.metrics;
|
||||
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.common.xcontent.XContentParser;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
import org.elasticsearch.script.Script;
|
||||
import org.elasticsearch.search.aggregations.AggregationInitializationException;
|
||||
|
@ -48,7 +48,7 @@ import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.env.EnvironmentModule;
|
||||
import org.elasticsearch.index.Index;
|
||||
import org.elasticsearch.index.query.AbstractQueryTestCase;
|
||||
import org.elasticsearch.test.AbstractQueryTestCase;
|
||||
import org.elasticsearch.index.query.EmptyQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.index.query.QueryParseContext;
|
||||
@ -97,8 +97,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.cluster.service.ClusterServiceUtils.setState;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.createClusterService;
|
||||
import static org.elasticsearch.test.ClusterServiceUtils.setState;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
public class SearchSourceBuilderTests extends ESTestCase {
|
||||
|
@ -29,10 +29,8 @@ import org.elasticsearch.action.admin.indices.segments.IndexShardSegments;
|
||||
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.Fuzziness;
|
||||
@ -65,7 +63,6 @@ import static com.carrotsearch.randomizedtesting.RandomizedTest.getRandom;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
@ -114,39 +111,6 @@ public class CompletionSuggestSearch2xIT extends ESIntegTestCase {
|
||||
assertSuggestionsNotInOrder("t", "The Prodigy", "Turbonegro", "Turbonegro Get it on", "The Prodigy Firestarter");
|
||||
}
|
||||
|
||||
public void testSuggestFieldWithPercolateApi() throws Exception {
|
||||
createIndexAndMapping(completionMappingBuilder);
|
||||
String[][] inputs = {{"Foo Fighters"}, {"Foo Fighters"}, {"Foo Fighters"}, {"Foo Fighters"},
|
||||
{"Generator", "Foo Fighters Generator"}, {"Learn to Fly", "Foo Fighters Learn to Fly"},
|
||||
{"The Prodigy"}, {"The Prodigy"}, {"The Prodigy"}, {"Firestarter", "The Prodigy Firestarter"},
|
||||
{"Turbonegro"}, {"Turbonegro"}, {"Get it on", "Turbonegro Get it on"}}; // work with frequencies
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
XContentBuilder source = jsonBuilder()
|
||||
.startObject().startObject(FIELD)
|
||||
.startArray("input");
|
||||
for (String input : inputs[i]) {
|
||||
source.value(input);
|
||||
}
|
||||
source.endArray()
|
||||
.endObject()
|
||||
.endObject();
|
||||
client().prepareIndex(INDEX, TYPE, "" + i)
|
||||
.setSource(source).execute().actionGet();
|
||||
}
|
||||
|
||||
client().prepareIndex(INDEX, ".percolator", "4")
|
||||
.setSource(jsonBuilder().startObject().field("query", matchAllQuery()).endObject())
|
||||
.execute().actionGet();
|
||||
|
||||
refresh();
|
||||
|
||||
PercolateResponse response = client().preparePercolate().setIndices(INDEX).setDocumentType(TYPE)
|
||||
.setGetRequest(Requests.getRequest(INDEX).type(TYPE).id("1"))
|
||||
.execute().actionGet();
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
|
||||
}
|
||||
|
||||
public void testBasicPrefixSuggestion() throws Exception {
|
||||
completionMappingBuilder.payloads(true);
|
||||
createIndexAndMapping(completionMappingBuilder);
|
||||
|
@ -31,17 +31,14 @@ import org.elasticsearch.action.admin.indices.segments.IndexShardSegments;
|
||||
import org.elasticsearch.action.admin.indices.segments.ShardSegments;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.ReduceSearchPhaseException;
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.Fuzziness;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.index.mapper.MapperParsingException;
|
||||
import org.elasticsearch.index.percolator.PercolatorFieldMapper;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
import org.elasticsearch.search.aggregations.AggregationBuilders;
|
||||
import org.elasticsearch.search.aggregations.Aggregator.SubAggCollectionMode;
|
||||
@ -71,7 +68,6 @@ import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.util.CollectionUtils.iterableAsArrayList;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
@ -394,39 +390,6 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testSuggestFieldWithPercolateApi() throws Exception {
|
||||
createIndexAndMapping(completionMappingBuilder);
|
||||
String[][] inputs = {{"Foo Fighters"}, {"Foo Fighters"}, {"Foo Fighters"}, {"Foo Fighters"},
|
||||
{"Generator", "Foo Fighters Generator"}, {"Learn to Fly", "Foo Fighters Learn to Fly"},
|
||||
{"The Prodigy"}, {"The Prodigy"}, {"The Prodigy"}, {"Firestarter", "The Prodigy Firestarter"},
|
||||
{"Turbonegro"}, {"Turbonegro"}, {"Get it on", "Turbonegro Get it on"}}; // work with frequencies
|
||||
for (int i = 0; i < inputs.length; i++) {
|
||||
XContentBuilder source = jsonBuilder()
|
||||
.startObject().startObject(FIELD)
|
||||
.startArray("input");
|
||||
for (String input : inputs[i]) {
|
||||
source.value(input);
|
||||
}
|
||||
source.endArray()
|
||||
.endObject()
|
||||
.endObject();
|
||||
client().prepareIndex(INDEX, TYPE, "" + i)
|
||||
.setSource(source).execute().actionGet();
|
||||
}
|
||||
client().admin().indices().preparePutMapping(INDEX).setType("query").setSource("query", "type=percolator").get();
|
||||
|
||||
client().prepareIndex(INDEX, "query", "4")
|
||||
.setSource(jsonBuilder().startObject().field("query", matchAllQuery()).endObject())
|
||||
.execute().actionGet();
|
||||
|
||||
refresh();
|
||||
|
||||
PercolateResponse response = client().preparePercolate().setIndices(INDEX).setDocumentType(TYPE)
|
||||
.setGetRequest(Requests.getRequest(INDEX).type(TYPE).id("1"))
|
||||
.execute().actionGet();
|
||||
assertThat(response.getCount(), equalTo(1L));
|
||||
}
|
||||
|
||||
public void testThatWeightsAreWorking() throws Exception {
|
||||
createIndexAndMapping(completionMappingBuilder);
|
||||
|
||||
|
@ -28,7 +28,6 @@ import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.percolate.PercolateResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.ActionFilter;
|
||||
@ -217,26 +216,6 @@ public class ContextAndHeaderTransportIT extends ESIntegTestCase {
|
||||
assertRequestsContainHeader(MultiTermVectorsRequest.class);
|
||||
}
|
||||
|
||||
public void testThatPercolatingExistingDocumentGetRequestContainsContextAndHeaders() throws Exception {
|
||||
Client client = transportClient();
|
||||
client.admin().indices().preparePutMapping(lookupIndex).setType("query").setSource("query", "type=percolator").get();
|
||||
client.prepareIndex(lookupIndex, "query", "1")
|
||||
.setSource(jsonBuilder().startObject()
|
||||
.startObject("query").startObject("match").field("name", "star wars").endObject().endObject()
|
||||
.endObject())
|
||||
.get();
|
||||
client.prepareIndex(lookupIndex, "type", "1")
|
||||
.setSource(jsonBuilder().startObject().field("name", "Star Wars - The new republic").endObject())
|
||||
.get();
|
||||
client.admin().indices().prepareRefresh(lookupIndex).get();
|
||||
|
||||
GetRequest getRequest = client.prepareGet(lookupIndex, "type", "1").request();
|
||||
PercolateResponse response = client.preparePercolate().setDocumentType("type").setGetRequest(getRequest).get();
|
||||
assertThat(response.getCount(), is(1L));
|
||||
|
||||
assertGetRequestsContainHeaders();
|
||||
}
|
||||
|
||||
public void testThatRelevantHttpHeadersBecomeRequestHeaders() throws Exception {
|
||||
String releventHeaderName = "relevant_" + randomHeaderKey;
|
||||
for (RestController restController : internalCluster().getDataNodeInstances(RestController.class)) {
|
||||
|
@ -1,8 +1,25 @@
|
||||
[[java-query-percolate-query]]
|
||||
==== Percolate query
|
||||
|
||||
See:
|
||||
* {ref}/query-dsl-percolate-query.html[Percolate Query]
|
||||
See: {ref}/query-dsl-percolate-query.html[Percolate Query]
|
||||
|
||||
In order to use the `percolate` query from the Java API your
|
||||
the percolator module dependency should be on the classpath and
|
||||
the transport client should be loaded with the percolator plugin:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
TransportClient transportClient = TransportClient.builder()
|
||||
.settings(Settings.builder().put("node.name", "node"))
|
||||
.addPlugin(PercolatorPlugin.class)
|
||||
.build();
|
||||
transportClient.addTransportAddress(
|
||||
new InetSocketTransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300))
|
||||
);
|
||||
--------------------------------------------------
|
||||
|
||||
Before the `percolate` query can be used an `percolator` mapping should be added and
|
||||
a document containing a percolator query should be indexed:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
|
@ -20,6 +20,9 @@ final query to execute.
|
||||
This query allows a script to act as a filter. Also see the
|
||||
<<java-query-dsl-function-score-query,`function_score` query>>.
|
||||
|
||||
<<java-query-percolate-query,`percolate` query>>::
|
||||
|
||||
This query finds percolator queries based on documents.
|
||||
|
||||
include::mlt-query.asciidoc[]
|
||||
|
||||
|
@ -46,4 +46,61 @@ the existing document.
|
||||
|
||||
==== Percolate Stats
|
||||
|
||||
The percolate stats have been removed. This is because the percolator no longer caches the percolator queries.
|
||||
The percolate stats have been removed. This is because the percolator no longer caches the percolator queries.
|
||||
|
||||
==== Java client
|
||||
|
||||
The percolator is no longer part of the core elasticsearch dependency. It has moved to the percolator module.
|
||||
Therefor when using the percolator feature from the Java client the new percolator module should also be on the
|
||||
classpath. Also the transport client should load the percolator module as plugin:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
TransportClient transportClient = TransportClient.builder()
|
||||
.settings(Settings.builder().put("node.name", "node"))
|
||||
.addPlugin(PercolatorPlugin.class)
|
||||
.build();
|
||||
transportClient.addTransportAddress(
|
||||
new InetSocketTransportAddress(new InetSocketAddress(InetAddresses.forString("127.0.0.1"), 9300))
|
||||
);
|
||||
--------------------------------------------------
|
||||
|
||||
The percolator and multi percolate related methods from the `Client` interface have been removed. These APIs have been
|
||||
deprecated and it is recommended to use the `percolate` query in either the search or multi search APIs. However the
|
||||
percolate and multi percolate APIs can still be used from the Java client.
|
||||
|
||||
Using percolate request:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
PercolateRequest request = new PercolateRequest();
|
||||
// set stuff and then execute:
|
||||
PercolateResponse response = transportClient.execute(PercolateAction.INSTANCE, request).actionGet();
|
||||
--------------------------------------------------
|
||||
|
||||
Using percolate request builder:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
PercolateRequestBuilder builder = new PercolateRequestBuilder(transportClient, PercolateAction.INSTANCE);
|
||||
// set stuff and then execute:
|
||||
PercolateResponse response = builder.get();
|
||||
--------------------------------------------------
|
||||
|
||||
Using multi percolate request:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
MultiPercolateRequest request = new MultiPercolateRequest();
|
||||
// set stuff and then execute:
|
||||
MultiPercolateResponse response = transportClient.execute(MultiPercolateAction.INSTANCE, request).get();
|
||||
--------------------------------------------------
|
||||
|
||||
Using multi percolate request builder:
|
||||
|
||||
[source,java]
|
||||
--------------------------------------------------
|
||||
MultiPercolateRequestBuilder builder = new MultiPercolateRequestBuilder(transportClient, MultiPercolateAction.INSTANCE);
|
||||
// set stuff and then execute:
|
||||
MultiPercolateResponse response = builder.get();
|
||||
--------------------------------------------------
|
@ -16,25 +16,11 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.index.percolator;
|
||||
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.index.Index;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Exception during indexing a percolator query.
|
||||
*/
|
||||
public class PercolatorException extends ElasticsearchException {
|
||||
|
||||
public PercolatorException(Index index, String msg, Throwable cause) {
|
||||
super(msg, cause);
|
||||
setIndex(index);
|
||||
}
|
||||
|
||||
public PercolatorException(StreamInput in) throws IOException{
|
||||
super(in);
|
||||
}
|
||||
esplugin {
|
||||
description 'Percolator module adds capability to index queries and query these queries by specifying documents'
|
||||
classname 'org.elasticsearch.percolator.PercolatorPlugin'
|
||||
}
|
||||
|
||||
compileJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes"
|
||||
compileTestJava.options.compilerArgs << "-Xlint:-deprecation,-rawtypes"
|
@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.index.percolator;
|
||||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.apache.lucene.document.Field;
|
||||
import org.apache.lucene.document.FieldType;
|
||||
@ -76,7 +76,8 @@ public final class ExtractQueryTermsService {
|
||||
* For example the query contained an unsupported query (e.g. WildcardQuery).
|
||||
* @param fieldType The field type for the query metadata field
|
||||
*/
|
||||
public static void extractQueryTerms(Query query, ParseContext.Document document, String queryTermsFieldField, String unknownQueryField, FieldType fieldType) {
|
||||
public static void extractQueryTerms(Query query, ParseContext.Document document, String queryTermsFieldField,
|
||||
String unknownQueryField, FieldType fieldType) {
|
||||
Set<Term> queryTerms;
|
||||
try {
|
||||
queryTerms = extractQueryTerms(query);
|
||||
@ -145,7 +146,8 @@ public final class ExtractQueryTermsService {
|
||||
for (BooleanClause clause : clauses) {
|
||||
if (clause.isRequired() == false) {
|
||||
// skip must_not clauses, we don't need to remember the things that do *not* match...
|
||||
// skip should clauses, this bq has must clauses, so we don't need to remember should clauses, since they are completely optional.
|
||||
// skip should clauses, this bq has must clauses, so we don't need to remember should clauses,
|
||||
// since they are completely optional.
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -234,7 +236,8 @@ public final class ExtractQueryTermsService {
|
||||
/**
|
||||
* Creates a boolean query with a should clause for each term on all fields of the specified index reader.
|
||||
*/
|
||||
public static Query createQueryTermsQuery(IndexReader indexReader, String queryMetadataField, String unknownQueryField) throws IOException {
|
||||
public static Query createQueryTermsQuery(IndexReader indexReader, String queryMetadataField,
|
||||
String unknownQueryField) throws IOException {
|
||||
Objects.requireNonNull(queryMetadataField);
|
||||
Objects.requireNonNull(unknownQueryField);
|
||||
|
@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.percolate;
|
||||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.elasticsearch.action.Action;
|
||||
import org.elasticsearch.client.ElasticsearchClient;
|
@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.percolate;
|
||||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.action.ActionRequest;
|
||||
@ -44,7 +44,10 @@ import static org.elasticsearch.common.xcontent.support.XContentMapValues.nodeSt
|
||||
|
||||
/**
|
||||
* A multi percolate request that encapsulates multiple {@link PercolateRequest} instances in a single api call.
|
||||
*
|
||||
* @deprecated Instead use multi search API with {@link PercolateQueryBuilder}
|
||||
*/
|
||||
@Deprecated
|
||||
public class MultiPercolateRequest extends ActionRequest<MultiPercolateRequest> implements CompositeIndicesRequest {
|
||||
|
||||
private String[] indices;
|
@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.percolate;
|
||||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.elasticsearch.action.ActionRequestBuilder;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
@ -24,7 +24,10 @@ import org.elasticsearch.client.ElasticsearchClient;
|
||||
|
||||
/**
|
||||
* A builder for to ease the use of defining a {@link MultiPercolateRequest} instance.
|
||||
*
|
||||
* @deprecated Instead use multi search API with {@link PercolateQueryBuilder}
|
||||
*/
|
||||
@Deprecated
|
||||
public class MultiPercolateRequestBuilder extends ActionRequestBuilder<MultiPercolateRequest, MultiPercolateResponse, MultiPercolateRequestBuilder> {
|
||||
|
||||
public MultiPercolateRequestBuilder(ElasticsearchClient client, MultiPercolateAction action) {
|
@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.elasticsearch.action.percolate;
|
||||
package org.elasticsearch.percolator;
|
||||
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
@ -36,7 +36,10 @@ import java.util.Iterator;
|
||||
*
|
||||
* Each item represents the response of a percolator request and the order of the items is in the same order as the
|
||||
* percolator requests were defined in the multi percolate request.
|
||||
*
|
||||
* @deprecated Instead use multi search API with {@link PercolateQueryBuilder}
|
||||
*/
|
||||
@Deprecated
|
||||
public class MultiPercolateResponse extends ActionResponse implements Iterable<MultiPercolateResponse.Item>, ToXContent {
|
||||
|
||||
private Item[] items;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user