Search in sources :

Example 1 with QueryCache

use of org.elasticsearch.index.cache.query.QueryCache in project crate by crate.

the class IndexModule method newIndexService.

public IndexService newIndexService(IndexService.IndexCreationContext indexCreationContext, NodeEnvironment environment, NamedXContentRegistry xContentRegistry, IndexService.ShardStoreDeleter shardStoreDeleter, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, IndicesQueryCache indicesQueryCache, MapperRegistry mapperRegistry) throws IOException {
    final IndexEventListener eventListener = freeze();
    eventListener.beforeIndexCreated(indexSettings.getIndex(), indexSettings.getSettings());
    final IndexStorePlugin.DirectoryFactory directoryFactory = getDirectoryFactory(indexSettings, directoryFactories);
    final QueryCache queryCache;
    if (indexSettings.getValue(INDEX_QUERY_CACHE_ENABLED_SETTING)) {
        BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider = forceQueryCacheProvider.get();
        if (queryCacheProvider == null) {
            queryCache = new IndexQueryCache(indexSettings, indicesQueryCache);
        } else {
            queryCache = queryCacheProvider.apply(indexSettings, indicesQueryCache);
        }
    } else {
        queryCache = new DisabledQueryCache(indexSettings);
    }
    return new IndexService(indexSettings, indexCreationContext, environment, xContentRegistry, shardStoreDeleter, analysisRegistry, engineFactory, circuitBreakerService, bigArrays, threadPool, queryCache, directoryFactory, eventListener, mapperRegistry, indexOperationListeners);
}
Also used : IndicesQueryCache(org.elasticsearch.indices.IndicesQueryCache) IndexEventListener(org.elasticsearch.index.shard.IndexEventListener) IndicesQueryCache(org.elasticsearch.indices.IndicesQueryCache) DisabledQueryCache(org.elasticsearch.index.cache.query.DisabledQueryCache) IndexQueryCache(org.elasticsearch.index.cache.query.IndexQueryCache) QueryCache(org.elasticsearch.index.cache.query.QueryCache) IndexQueryCache(org.elasticsearch.index.cache.query.IndexQueryCache) IndexStorePlugin(org.elasticsearch.plugins.IndexStorePlugin) DisabledQueryCache(org.elasticsearch.index.cache.query.DisabledQueryCache)

Example 2 with QueryCache

use of org.elasticsearch.index.cache.query.QueryCache in project elasticsearch by elastic.

the class IndexModule method newIndexService.

public IndexService newIndexService(NodeEnvironment environment, NamedXContentRegistry xContentRegistry, IndexService.ShardStoreDeleter shardStoreDeleter, CircuitBreakerService circuitBreakerService, BigArrays bigArrays, ThreadPool threadPool, ScriptService scriptService, ClusterService clusterService, Client client, IndicesQueryCache indicesQueryCache, MapperRegistry mapperRegistry, Consumer<ShardId> globalCheckpointSyncer, IndicesFieldDataCache indicesFieldDataCache) throws IOException {
    final IndexEventListener eventListener = freeze();
    IndexSearcherWrapperFactory searcherWrapperFactory = indexSearcherWrapper.get() == null ? (shard) -> null : indexSearcherWrapper.get();
    eventListener.beforeIndexCreated(indexSettings.getIndex(), indexSettings.getSettings());
    final String storeType = indexSettings.getValue(INDEX_STORE_TYPE_SETTING);
    final IndexStore store;
    if (Strings.isEmpty(storeType) || isBuiltinType(storeType)) {
        store = new IndexStore(indexSettings);
    } else {
        Function<IndexSettings, IndexStore> factory = storeTypes.get(storeType);
        if (factory == null) {
            throw new IllegalArgumentException("Unknown store type [" + storeType + "]");
        }
        store = factory.apply(indexSettings);
        if (store == null) {
            throw new IllegalStateException("store must not be null");
        }
    }
    final QueryCache queryCache;
    if (indexSettings.getValue(INDEX_QUERY_CACHE_ENABLED_SETTING)) {
        BiFunction<IndexSettings, IndicesQueryCache, QueryCache> queryCacheProvider = forceQueryCacheProvider.get();
        if (queryCacheProvider == null) {
            queryCache = new IndexQueryCache(indexSettings, indicesQueryCache);
        } else {
            queryCache = queryCacheProvider.apply(indexSettings, indicesQueryCache);
        }
    } else {
        queryCache = new DisabledQueryCache(indexSettings);
    }
    return new IndexService(indexSettings, environment, xContentRegistry, new SimilarityService(indexSettings, similarities), shardStoreDeleter, analysisRegistry, engineFactory.get(), circuitBreakerService, bigArrays, threadPool, scriptService, clusterService, client, queryCache, store, eventListener, searcherWrapperFactory, mapperRegistry, indicesFieldDataCache, globalCheckpointSyncer, searchOperationListeners, indexOperationListeners);
}
Also used : IndicesQueryCache(org.elasticsearch.indices.IndicesQueryCache) IndicesQueryCache(org.elasticsearch.indices.IndicesQueryCache) DisabledQueryCache(org.elasticsearch.index.cache.query.DisabledQueryCache) IndexQueryCache(org.elasticsearch.index.cache.query.IndexQueryCache) QueryCache(org.elasticsearch.index.cache.query.QueryCache) IndexQueryCache(org.elasticsearch.index.cache.query.IndexQueryCache) IndexEventListener(org.elasticsearch.index.shard.IndexEventListener) SimilarityService(org.elasticsearch.index.similarity.SimilarityService) IndexStore(org.elasticsearch.index.store.IndexStore) DisabledQueryCache(org.elasticsearch.index.cache.query.DisabledQueryCache)

Aggregations

DisabledQueryCache (org.elasticsearch.index.cache.query.DisabledQueryCache)2 IndexQueryCache (org.elasticsearch.index.cache.query.IndexQueryCache)2 QueryCache (org.elasticsearch.index.cache.query.QueryCache)2 IndexEventListener (org.elasticsearch.index.shard.IndexEventListener)2 IndicesQueryCache (org.elasticsearch.indices.IndicesQueryCache)2 SimilarityService (org.elasticsearch.index.similarity.SimilarityService)1 IndexStore (org.elasticsearch.index.store.IndexStore)1 IndexStorePlugin (org.elasticsearch.plugins.IndexStorePlugin)1