本文整理汇总了Java中org.elasticsearch.percolator.PercolatorService类的典型用法代码示例。如果您正苦于以下问题:Java PercolatorService类的具体用法?Java PercolatorService怎么用?Java PercolatorService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PercolatorService类属于org.elasticsearch.percolator包,在下文中一共展示了PercolatorService类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadQueries
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
private int loadQueries(IndexShard shard) {
shard.refresh("percolator_load_queries");
// NOTE: we acquire the searcher via the engine directly here since this is executed right
// before the shard is marked as POST_RECOVERY
try (Engine.Searcher searcher = shard.engine().acquireSearcher("percolator_load_queries")) {
Query query = new TermQuery(new Term(TypeFieldMapper.NAME, PercolatorService.TYPE_NAME));
QueriesLoaderCollector queryCollector = new QueriesLoaderCollector(PercolatorQueriesRegistry.this, logger, mapperService, indexFieldDataService);
IndexSearcher indexSearcher = new IndexSearcher(searcher.reader());
indexSearcher.setQueryCache(null);
indexSearcher.search(query, queryCollector);
Map<BytesRef, Query> queries = queryCollector.queries();
for (Map.Entry<BytesRef, Query> entry : queries.entrySet()) {
Query previousQuery = percolateQueries.put(entry.getKey(), entry.getValue());
shardPercolateService.addedQuery(entry.getKey(), previousQuery, entry.getValue());
}
return queries.size();
} catch (Exception e) {
throw new PercolatorException(shardId.index(), "failed to load queries from percolator index", e);
}
}
示例2: preCreate
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public Engine.Create preCreate(Engine.Create create) {
// validate the query here, before we index
if (PercolatorService.TYPE_NAME.equals(create.type())) {
parsePercolatorDocument(create.id(), create.source());
}
return create;
}
示例3: postCreateUnderLock
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public void postCreateUnderLock(Engine.Create create) {
// add the query under a doc lock
if (PercolatorService.TYPE_NAME.equals(create.type())) {
addPercolateQuery(create.id(), create.source());
}
}
示例4: preIndex
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public Engine.Index preIndex(Engine.Index index) {
// validate the query here, before we index
if (PercolatorService.TYPE_NAME.equals(index.type())) {
parsePercolatorDocument(index.id(), index.source());
}
return index;
}
示例5: postIndexUnderLock
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public void postIndexUnderLock(Engine.Index index) {
// add the query under a doc lock
if (PercolatorService.TYPE_NAME.equals(index.type())) {
addPercolateQuery(index.id(), index.source());
}
}
示例6: postDeleteUnderLock
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public void postDeleteUnderLock(Engine.Delete delete) {
// remove the query under a lock
if (PercolatorService.TYPE_NAME.equals(delete.type())) {
removePercolateQuery(delete.id());
}
}
示例7: parse
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
public DocumentMapper parse(String mappingType, CompressedXContent mappingSource, boolean applyDefault) throws MapperParsingException {
String defaultMappingSource;
if (PercolatorService.TYPE_NAME.equals(mappingType)) {
defaultMappingSource = this.defaultPercolatorMappingSource;
} else {
defaultMappingSource = this.defaultMappingSource;
}
return documentParser.parse(mappingType, mappingSource, applyDefault ? defaultMappingSource : null);
}
示例8: TransportPercolateAction
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Inject
public TransportPercolateAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, PercolatorService percolatorService,
TransportGetAction getAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, PercolateAction.NAME, threadPool, clusterService, transportService, actionFilters,
indexNameExpressionResolver, PercolateRequest.class, PercolateShardRequest.class, ThreadPool.Names.PERCOLATE);
this.percolatorService = percolatorService;
this.getAction = getAction;
}
示例9: TransportMultiPercolateAction
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Inject
public TransportMultiPercolateAction(Settings settings, ThreadPool threadPool, TransportShardMultiPercolateAction shardMultiPercolateAction,
ClusterService clusterService, TransportService transportService, PercolatorService percolatorService,
TransportMultiGetAction multiGetAction, ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, MultiPercolateAction.NAME, threadPool, transportService, actionFilters, indexNameExpressionResolver, MultiPercolateRequest.class);
this.shardMultiPercolateAction = shardMultiPercolateAction;
this.clusterService = clusterService;
this.percolatorService = percolatorService;
this.multiGetAction = multiGetAction;
}
示例10: TransportShardMultiPercolateAction
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Inject
public TransportShardMultiPercolateAction(Settings settings, ThreadPool threadPool, ClusterService clusterService,
TransportService transportService, PercolatorService percolatorService,
ActionFilters actionFilters, IndexNameExpressionResolver indexNameExpressionResolver) {
super(settings, ACTION_NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver,
Request.class, ThreadPool.Names.PERCOLATE);
this.percolatorService = percolatorService;
}
示例11: beforeCreate
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
@Override
public void beforeCreate(DocumentMapper mapper) {
if (PercolatorService.TYPE_NAME.equals(mapper.type())) {
enableRealTimePercolator();
}
}
示例12: hasPercolatorType
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
private boolean hasPercolatorType(IndexShard indexShard) {
ShardId otherShardId = indexShard.shardId();
return shardId.equals(otherShardId) && mapperService.hasMapping(PercolatorService.TYPE_NAME);
}
示例13: typeNameStartsWithIllegalDot
import org.elasticsearch.percolator.PercolatorService; //导入依赖的package包/类
private boolean typeNameStartsWithIllegalDot(DocumentMapper mapper) {
return mapper.type().startsWith(".") && !PercolatorService.TYPE_NAME.equals(mapper.type());
}