Search in sources :

Example 1 with IndexStore

use of org.elasticsearch.index.store.IndexStore 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)1 IndexQueryCache (org.elasticsearch.index.cache.query.IndexQueryCache)1 QueryCache (org.elasticsearch.index.cache.query.QueryCache)1 IndexEventListener (org.elasticsearch.index.shard.IndexEventListener)1 SimilarityService (org.elasticsearch.index.similarity.SimilarityService)1 IndexStore (org.elasticsearch.index.store.IndexStore)1 IndicesQueryCache (org.elasticsearch.indices.IndicesQueryCache)1