org.elasticsearch.common.logging.ESLogger Java Examples
The following examples show how to use
org.elasticsearch.common.logging.ESLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PageDownstreamContext.java From Elasticsearch with Apache License 2.0 | 6 votes |
public PageDownstreamContext(ESLogger logger, String nodeName, int id, String name, PageDownstream pageDownstream, Streamer<?>[] streamer, RamAccountingContext ramAccountingContext, int numBuckets, @Nullable FlatProjectorChain projectorChain) { super(id, logger); this.nodeName = nodeName; this.name = name; this.pageDownstream = pageDownstream; this.streamer = streamer; this.ramAccountingContext = ramAccountingContext; this.numBuckets = numBuckets; this.projectorChain = projectorChain; bucketFutures = new ArrayList<>(numBuckets); allFuturesSet = new BitSet(numBuckets); exhausted = new BitSet(numBuckets); initBucketFutures(); }
Example #2
Source File: ScriptParameterParser.java From Elasticsearch with Apache License 2.0 | 6 votes |
public ScriptParameterParser(Set<String> parameterNames) { ESLogger logger = Loggers.getLogger(getClass()); deprecationLogger = new DeprecationLogger(logger); if (parameterNames == null || parameterNames.isEmpty()) { inlineParameters = Collections.singleton(ScriptService.SCRIPT_INLINE); fileParameters = Collections.singleton(ScriptService.SCRIPT_FILE); indexedParameters = Collections.singleton(ScriptService.SCRIPT_ID); } else { inlineParameters = new HashSet<>(); fileParameters = new HashSet<>(); indexedParameters = new HashSet<>(); for (String parameterName : parameterNames) { if (ParseFieldMatcher.EMPTY.match(parameterName, ScriptService.SCRIPT_LANG)) { throw new IllegalArgumentException("lang is reserved and cannot be used as a parameter name"); } inlineParameters.add(new ParseField(parameterName)); fileParameters.add(new ParseField(parameterName + FILE_SUFFIX)); indexedParameters.add(new ParseField(parameterName + INDEXED_SUFFIX)); } } }
Example #3
Source File: InternalClusterInfoService.java From Elasticsearch with Apache License 2.0 | 6 votes |
static void buildShardLevelInfo(ESLogger logger, ShardStats[] stats, HashMap<String, Long> newShardSizes, HashMap<ShardRouting, String> newShardRoutingToDataPath, ClusterState state) { MetaData meta = state.getMetaData(); for (ShardStats s : stats) { IndexMetaData indexMeta = meta.index(s.getShardRouting().index()); Settings indexSettings = indexMeta == null ? null : indexMeta.getSettings(); newShardRoutingToDataPath.put(s.getShardRouting(), s.getDataPath()); long size = s.getStats().getStore().sizeInBytes(); String sid = ClusterInfo.shardIdentifierFromRouting(s.getShardRouting()); if (logger.isTraceEnabled()) { logger.trace("shard: {} size: {}", sid, size); } if (indexSettings != null && IndexMetaData.isIndexUsingShadowReplicas(indexSettings)) { // Shards on a shared filesystem should be considered of size 0 if (logger.isTraceEnabled()) { logger.trace("shard: {} is using shadow replicas and will be treated as size 0", sid); } size = 0; } newShardSizes.put(sid, size); } }
Example #4
Source File: KerberosRealm.java From elasticsearch-shield-kerberos-realm with Apache License 2.0 | 6 votes |
private static String getUsernameFromGSSContext(final GSSContext gssContext, final boolean strip, final ESLogger logger) { if (gssContext.isEstablished()) { GSSName gssName = null; try { gssName = gssContext.getSrcName(); } catch (final GSSException e) { logger.error("Unable to get src name from gss context", e); } if (gssName != null) { String name = gssName.toString(); return stripRealmName(name, strip); } } return null; }
Example #5
Source File: MetaData.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** As of 2.0 we require units for time and byte-sized settings. * This methods adds default units to any settings that are part of timeSettings or byteSettings and don't specify a unit. **/ @Nullable public static Settings addDefaultUnitsIfNeeded(Set<String> timeSettings, Set<String> byteSettings, ESLogger logger, Settings settings) { Settings.Builder newSettingsBuilder = null; for (Map.Entry<String, String> entry : settings.getAsMap().entrySet()) { String settingName = entry.getKey(); String settingValue = entry.getValue(); String newSettingValue = convertedValue(timeSettings, settingName, settingValue, logger, "ms", "time"); if (settingValue.equals(newSettingValue) == false) { newSettingsBuilder = initSettingsBuilder(settings, newSettingsBuilder); newSettingsBuilder.put(settingName, newSettingValue); } newSettingValue = convertedValue(byteSettings, settingName, settingValue, logger, "b", "byte-sized"); if (settingValue.equals(newSettingValue) == false) { newSettingsBuilder = initSettingsBuilder(settings, newSettingsBuilder); newSettingsBuilder.put(settingName, newSettingValue); } } if (newSettingsBuilder == null) { return settings; } return newSettingsBuilder.build(); }
Example #6
Source File: MetaData.java From Elasticsearch with Apache License 2.0 | 6 votes |
private static String convertedValue(Set<String> settingsThatRequireUnits, String settingName, String settingValue, ESLogger logger, String unit, String unitName) { if (settingsThatRequireUnits.contains(settingName) == false) { return settingValue; } try { Long.parseLong(settingValue); } catch (NumberFormatException e) { return settingValue; } // It's a naked number that previously would be interpreted as default unit; now we add it: logger.warn("{} setting [{}] with value [{}] is missing units; assuming default units ({}) but in future versions this will be a hard error", unitName, settingName, settingValue, unit); return settingValue + unit; }
Example #7
Source File: ChildMemoryCircuitBreaker.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** * Create a circuit breaker that will break if the number of estimated * bytes grows above the limit. All estimations will be multiplied by * the given overheadConstant. Uses the given oldBreaker to initialize * the starting offset. * @param settings settings to configure this breaker * @param parent parent circuit breaker service to delegate tripped breakers to * @param name the name of the breaker * @param oldBreaker the previous circuit breaker to inherit the used value from (starting offset) */ public ChildMemoryCircuitBreaker(BreakerSettings settings, ChildMemoryCircuitBreaker oldBreaker, ESLogger logger, HierarchyCircuitBreakerService parent, String name) { this.name = name; this.settings = settings; this.memoryBytesLimit = settings.getLimit(); this.overheadConstant = settings.getOverhead(); if (oldBreaker == null) { this.used = new AtomicLong(0); this.trippedCount = new AtomicLong(0); } else { this.used = oldBreaker.used; this.trippedCount = oldBreaker.trippedCount; } this.logger = logger; if (logger.isTraceEnabled()) { logger.trace("creating ChildCircuitBreaker with settings {}", this.settings); } this.parent = parent; }
Example #8
Source File: MemoryCircuitBreaker.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** * Create a circuit breaker that will break if the number of estimated * bytes grows above the limit. All estimations will be multiplied by * the given overheadConstant. Uses the given oldBreaker to initialize * the starting offset. * @param limit circuit breaker limit * @param overheadConstant constant multiplier for byte estimations * @param oldBreaker the previous circuit breaker to inherit the used value from (starting offset) */ public MemoryCircuitBreaker(ByteSizeValue limit, double overheadConstant, MemoryCircuitBreaker oldBreaker, ESLogger logger) { this.memoryBytesLimit = limit.bytes(); this.overheadConstant = overheadConstant; if (oldBreaker == null) { this.used = new AtomicLong(0); this.trippedCount = new AtomicLong(0); } else { this.used = oldBreaker.used; this.trippedCount = oldBreaker.trippedCount; } this.logger = logger; if (logger.isTraceEnabled()) { logger.trace("Creating MemoryCircuitBreaker with a limit of {} bytes ({}) and a overhead constant of {}", this.memoryBytesLimit, limit, this.overheadConstant); } }
Example #9
Source File: MultiDataPathUpgrader.java From Elasticsearch with Apache License 2.0 | 6 votes |
/** * Runs an upgrade on all shards located under the given node environment if there is more than 1 data.path configured * otherwise this method will return immediately. */ public static void upgradeMultiDataPath(NodeEnvironment nodeEnv, ESLogger logger) throws IOException { if (nodeEnv.nodeDataPaths().length > 1) { final MultiDataPathUpgrader upgrader = new MultiDataPathUpgrader(nodeEnv); final Set<String> allIndices = nodeEnv.findAllIndices(); for (String index : allIndices) { for (ShardId shardId : findAllShardIds(nodeEnv.indexPaths(new Index(index)))) { try (ShardLock lock = nodeEnv.shardLock(shardId, 0)) { if (upgrader.needsUpgrading(shardId)) { final ShardPath shardPath = upgrader.pickShardPath(shardId); upgrader.upgrade(shardId, shardPath); // we have to check if the index path exists since we might // have only upgraded the shard state that is written under /indexname/shardid/_state // in the case we upgraded a dedicated index directory index if (Files.exists(shardPath.resolveIndex())) { upgrader.checkIndex(shardPath); } } else { logger.debug("{} no upgrade needed - already upgraded", shardId); } } } } } }
Example #10
Source File: NestedLoopContext.java From Elasticsearch with Apache License 2.0 | 5 votes |
public NestedLoopContext(ESLogger logger, NestedLoopPhase phase, FlatProjectorChain flatProjectorChain, NestedLoopOperation nestedLoopOperation, @Nullable PageDownstreamContext leftPageDownstreamContext, @Nullable PageDownstreamContext rightPageDownstreamContext) { super(phase.executionPhaseId(), logger); nestedLoopPhase = phase; this.flatProjectorChain = flatProjectorChain; this.leftPageDownstreamContext = leftPageDownstreamContext; this.rightPageDownstreamContext = rightPageDownstreamContext; leftRowReceiver = nestedLoopOperation.leftRowReceiver(); rightRowReceiver = nestedLoopOperation.rightRowReceiver(); if (leftPageDownstreamContext == null) { Futures.addCallback(leftRowReceiver.finishFuture(), new RemoveContextCallback()); } else { leftPageDownstreamContext.future.addCallback(new RemoveContextCallback()); } if (rightPageDownstreamContext == null) { Futures.addCallback(rightRowReceiver.finishFuture(), new RemoveContextCallback()); } else { rightPageDownstreamContext.future.addCallback(new RemoveContextCallback()); } }
Example #11
Source File: JarHell.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * Checks the current classpath for duplicate classes * @throws IllegalStateException if jar hell was found */ public static void checkJarHell() throws Exception { ClassLoader loader = JarHell.class.getClassLoader(); ESLogger logger = Loggers.getLogger(JarHell.class); if (logger.isDebugEnabled()) { logger.debug("java.class.path: {}", System.getProperty("java.class.path")); logger.debug("sun.boot.class.path: {}", System.getProperty("sun.boot.class.path")); if (loader instanceof URLClassLoader ) { logger.debug("classloader urls: {}", Arrays.toString(((URLClassLoader)loader).getURLs())); } } checkJarHell(parseClassPath()); }
Example #12
Source File: QueryCollector.java From Elasticsearch with Apache License 2.0 | 5 votes |
MatchAndScore(ESLogger logger, PercolateContext context, HighlightPhase highlightPhase, boolean isNestedDoc) throws IOException { super(logger, context, isNestedDoc); this.limit = context.limit; this.size = context.size(); this.context = context; this.highlightPhase = highlightPhase; }
Example #13
Source File: DistributingDownstream.java From Elasticsearch with Apache License 2.0 | 5 votes |
public DistributingDownstream(ESLogger logger, UUID jobId, MultiBucketBuilder multiBucketBuilder, int targetExecutionPhaseId, byte inputId, int bucketIdx, Collection<String> downstreamNodeIds, TransportDistributedResultAction transportDistributedResultAction, Streamer<?>[] streamers, int pageSize) { this.logger = logger; this.jobId = jobId; this.multiBucketBuilder = multiBucketBuilder; this.targetExecutionPhaseId = targetExecutionPhaseId; this.inputId = inputId; this.bucketIdx = bucketIdx; this.transportDistributedResultAction = transportDistributedResultAction; this.streamers = streamers; this.pageSize = pageSize; buckets = new Bucket[downstreamNodeIds.size()]; downstreams = new Downstream[downstreamNodeIds.size()]; int i = 0; for (String downstreamNodeId : downstreamNodeIds) { downstreams[i] = new Downstream(downstreamNodeId); i++; } }
Example #14
Source File: IndexingSlowLog.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * Build with the specified loggers. Only used to testing. */ IndexingSlowLog(Settings indexSettings, ESLogger indexLogger, ESLogger deleteLogger) { this.indexLogger = indexLogger; this.deleteLogger = deleteLogger; this.reformat = indexSettings.getAsBoolean(INDEX_INDEXING_SLOWLOG_REFORMAT, true); this.indexWarnThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_WARN, TimeValue.timeValueNanos(-1)).nanos(); this.indexInfoThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_INFO, TimeValue.timeValueNanos(-1)).nanos(); this.indexDebugThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_DEBUG, TimeValue.timeValueNanos(-1)).nanos(); this.indexTraceThreshold = indexSettings.getAsTime(INDEX_INDEXING_SLOWLOG_THRESHOLD_INDEX_TRACE, TimeValue.timeValueNanos(-1)).nanos(); this.level = indexSettings.get(INDEX_INDEXING_SLOWLOG_LEVEL, "TRACE").toUpperCase(Locale.ROOT); this.maxSourceCharsToLog = readSourceToLog(indexSettings); indexLogger.setLevel(level); deleteLogger.setLevel(level); }
Example #15
Source File: Node.java From Elasticsearch with Apache License 2.0 | 5 votes |
private Node stop() { if (!lifecycle.moveToStopped()) { return this; } ESLogger logger = Loggers.getLogger(Node.class, settings.get("name")); logger.info("stopping ..."); injector.getInstance(TribeService.class).stop(); injector.getInstance(ResourceWatcherService.class).stop(); if (settings.getAsBoolean("http.enabled", true)) { injector.getInstance(HttpServer.class).stop(); } injector.getInstance(SnapshotsService.class).stop(); injector.getInstance(SnapshotShardsService.class).stop(); // stop any changes happening as a result of cluster state changes injector.getInstance(IndicesClusterStateService.class).stop(); // we close indices first, so operations won't be allowed on it injector.getInstance(IndexingMemoryController.class).stop(); injector.getInstance(IndicesTTLService.class).stop(); injector.getInstance(RoutingService.class).stop(); injector.getInstance(ClusterService.class).stop(); injector.getInstance(DiscoveryService.class).stop(); injector.getInstance(MonitorService.class).stop(); injector.getInstance(GatewayService.class).stop(); injector.getInstance(SearchService.class).stop(); injector.getInstance(RestController.class).stop(); injector.getInstance(TransportService.class).stop(); for (Class<? extends LifecycleComponent> plugin : pluginsService.nodeServices()) { injector.getInstance(plugin).stop(); } // we should stop this last since it waits for resources to get released // if we had scroll searchers etc or recovery going on we wait for to finish. injector.getInstance(IndicesService.class).stop(); logger.info("stopped"); return this; }
Example #16
Source File: GenTermValuesHandler.java From elasticsearch-taste with Apache License 2.0 | 5 votes |
public MultiTermVectorsListener(final int numOfThread, final RequestHandler[] requestHandlers, final Params eventParams, final Map<String, DocInfo> idMap, final ExecutorService executor, final ESLogger logger) { this.requestHandlers = requestHandlers; this.eventParams = eventParams; this.idMap = idMap; this.executor = executor; this.logger = logger; this.numOfThread = numOfThread > 1 ? numOfThread : 1; }
Example #17
Source File: TranslogRecoveryPerformer.java From Elasticsearch with Apache License 2.0 | 5 votes |
protected TranslogRecoveryPerformer(ShardId shardId, MapperService mapperService, IndexQueryParserService queryParserService, IndexAliasesService indexAliasesService, IndexCache indexCache, ESLogger logger) { this.shardId = shardId; this.mapperService = mapperService; this.queryParserService = queryParserService; this.indexAliasesService = indexAliasesService; this.indexCache = indexCache; this.logger = logger; }
Example #18
Source File: IndexShard.java From Elasticsearch with Apache License 2.0 | 5 votes |
private static Translog.Durabilty getFromSettings(ESLogger logger, Settings settings, Translog.Durabilty defaultValue) { final String value = settings.get(TranslogConfig.INDEX_TRANSLOG_DURABILITY, defaultValue.name()); try { return Translog.Durabilty.valueOf(value.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ex) { logger.warn("Can't apply {} illegal value: {} using {} instead, use one of: {}", TranslogConfig.INDEX_TRANSLOG_DURABILITY, value, defaultValue, Arrays.toString(Translog.Durabilty.values())); return defaultValue; } }
Example #19
Source File: Analysis.java From Elasticsearch with Apache License 2.0 | 5 votes |
public static Version parseAnalysisVersion(Settings indexSettings, Settings settings, ESLogger logger) { // check for explicit version on the specific analyzer component String sVersion = settings.get("version"); if (sVersion != null) { return Lucene.parseVersion(sVersion, Lucene.ANALYZER_VERSION, logger); } // check for explicit version on the index itself as default for all analysis components sVersion = indexSettings.get("index.analysis.version"); if (sVersion != null) { return Lucene.parseVersion(sVersion, Lucene.ANALYZER_VERSION, logger); } // resolve the analysis version based on the version the index was created with return org.elasticsearch.Version.indexCreated(indexSettings).luceneVersion; }
Example #20
Source File: Store.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * Returns <code>true</code> iff the given location contains an index an the index * can be successfully opened. This includes reading the segment infos and possible * corruption markers. */ public static boolean canOpenIndex(ESLogger logger, Path indexLocation) throws IOException { try { tryOpenIndex(indexLocation); } catch (Exception ex) { logger.trace("Can't open index for path [{}]", ex, indexLocation); return false; } return true; }
Example #21
Source File: Search.java From elasticsearch-rest-command with The Unlicense | 5 votes |
static void dumpSearchScript(SearchRequestBuilder search, ESLogger logger) { try { XContentBuilder builder = XContentFactory .contentBuilder(XContentType.JSON); search.internalBuilder().toXContent(builder, ToXContent.EMPTY_PARAMS); logger.info(builder.bytes().toUtf8()); } catch (IOException e) { logger.info(e.getMessage()); } }
Example #22
Source File: TransportChannelResponseHandler.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * Convenience method for delegating an empty response to the provided changed */ public static TransportChannelResponseHandler<TransportResponse.Empty> emptyResponseHandler(ESLogger logger, TransportChannel channel, String extraInfoOnError) { return new TransportChannelResponseHandler<TransportResponse.Empty>(logger, channel, extraInfoOnError) { @Override public TransportResponse.Empty newInstance() { return TransportResponse.Empty.INSTANCE; } }; }
Example #23
Source File: MessageChannelHandler.java From Elasticsearch with Apache License 2.0 | 5 votes |
public MessageChannelHandler(NettyTransport transport, ESLogger logger, String profileName) { this.threadPool = transport.threadPool(); this.transportServiceAdapter = transport.transportServiceAdapter(); this.transport = transport; this.logger = logger; this.profileName = profileName; }
Example #24
Source File: SearchScrollScanAsyncAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
SearchScrollScanAsyncAction(ESLogger logger, ClusterService clusterService, SearchServiceTransportAction searchService, SearchPhaseController searchPhaseController, SearchScrollRequest request, ParsedScrollId scrollId, ActionListener<SearchResponse> listener) { this.logger = logger; this.searchService = searchService; this.clusterService = clusterService; this.searchPhaseController = searchPhaseController; this.request = request; this.listener = listener; this.scrollId = scrollId; this.nodes = clusterService.state().nodes(); this.successfulOps = new AtomicInteger(scrollId.getContext().length); this.counter = new AtomicInteger(scrollId.getContext().length); this.queryFetchResults = new AtomicArray<>(scrollId.getContext().length); }
Example #25
Source File: AsyncShardFetch.java From Elasticsearch with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected AsyncShardFetch(ESLogger logger, String type, ShardId shardId, List<? extends BaseNodesResponse<T>, T> action) { this.logger = logger; this.type = type; this.shardId = shardId; this.action = (List<BaseNodesResponse<T>, T>) action; }
Example #26
Source File: ClusterModule.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Override protected void configure() { bind(DynamicSettings.class).annotatedWith(ClusterDynamicSettings.class).toInstance(clusterDynamicSettings.build()); bind(DynamicSettings.class).annotatedWith(IndexDynamicSettings.class).toInstance(indexDynamicSettings.build()); // bind ShardsAllocator String shardsAllocatorType = shardsAllocators.bindType(binder(), settings, ClusterModule.SHARDS_ALLOCATOR_TYPE_KEY, ClusterModule.BALANCED_ALLOCATOR); if (shardsAllocatorType.equals(ClusterModule.EVEN_SHARD_COUNT_ALLOCATOR)) { final ESLogger logger = Loggers.getLogger(getClass(), settings); logger.warn("{} allocator has been removed in 2.0 using {} instead", ClusterModule.EVEN_SHARD_COUNT_ALLOCATOR, ClusterModule.BALANCED_ALLOCATOR); } allocationDeciders.bind(binder()); indexTemplateFilters.bind(binder()); bind(ClusterInfoService.class).to(clusterInfoServiceImpl).asEagerSingleton(); bind(GatewayAllocator.class).asEagerSingleton(); bind(AllocationService.class).asEagerSingleton(); bind(DiscoveryNodeService.class).asEagerSingleton(); bind(ClusterService.class).to(InternalClusterService.class).asEagerSingleton(); bind(OperationRouting.class).asEagerSingleton(); bind(MetaDataCreateIndexService.class).asEagerSingleton(); bind(MetaDataDeleteIndexService.class).asEagerSingleton(); bind(MetaDataIndexStateService.class).asEagerSingleton(); bind(MetaDataMappingService.class).asEagerSingleton(); bind(MetaDataIndexAliasesService.class).asEagerSingleton(); bind(MetaDataUpdateSettingsService.class).asEagerSingleton(); bind(MetaDataIndexTemplateService.class).asEagerSingleton(); bind(IndexNameExpressionResolver.class).asEagerSingleton(); bind(RoutingService.class).asEagerSingleton(); bind(ShardStateAction.class).asEagerSingleton(); bind(NodeIndexDeletedAction.class).asEagerSingleton(); bind(NodeMappingRefreshAction.class).asEagerSingleton(); bind(MappingUpdatedAction.class).asEagerSingleton(); }
Example #27
Source File: ClusterStateObserver.java From Elasticsearch with Apache License 2.0 | 5 votes |
/** * @param timeout a global timeout for this observer. After it has expired the observer * will fail any existing or new #waitForNextChange calls. Set to null * to wait indefinitely */ public ClusterStateObserver(ClusterService clusterService, @Nullable TimeValue timeout, ESLogger logger) { this.clusterService = clusterService; this.lastObservedState = new AtomicReference<>(new ObservedState(clusterService.state())); this.timeOutValue = timeout; if (timeOutValue != null) { this.startTimeNS = System.nanoTime(); } this.logger = logger; }
Example #28
Source File: BalancedShardsAllocator.java From Elasticsearch with Apache License 2.0 | 5 votes |
public Balancer(ESLogger logger, RoutingAllocation allocation, WeightFunction weight, float threshold) { this.logger = logger; this.allocation = allocation; this.weight = weight; this.threshold = threshold; this.routingNodes = allocation.routingNodes(); for (RoutingNode node : routingNodes) { nodes.put(node.nodeId(), new ModelNode(node.nodeId())); } metaData = routingNodes.metaData(); avgShardsPerNode = ((float) metaData.totalNumberOfShards()) / nodes.size(); }
Example #29
Source File: MetaData.java From Elasticsearch with Apache License 2.0 | 5 votes |
@Nullable private static ImmutableOpenMap<String, IndexTemplateMetaData> updateTemplates( ESLogger logger, ImmutableOpenMap<String, IndexTemplateMetaData> templates) { ImmutableOpenMap.Builder<String, IndexTemplateMetaData> builder = null; for (ObjectObjectCursor<String, IndexTemplateMetaData> cursor : templates) { IndexTemplateMetaData templateMetaData = cursor.value; Settings currentSettings = templateMetaData.getSettings(); Settings newSettings = addDefaultUnitsIfNeeded( MetaDataIndexUpgradeService.INDEX_TIME_SETTINGS, MetaDataIndexUpgradeService.INDEX_BYTES_SIZE_SETTINGS, logger, currentSettings); if (newSettings != currentSettings) { if (builder == null) { builder = ImmutableOpenMap.builder(); builder.putAll(templates); } builder.put(cursor.key, new IndexTemplateMetaData( templateMetaData.name(), templateMetaData.order(), templateMetaData.template(), newSettings, templateMetaData.mappings(), templateMetaData.aliases(), templateMetaData.customs(), templateMetaData.templateOwnerTenantId() )); } } if (builder == null) { return null; } return builder.build(); }
Example #30
Source File: SearchQueryThenFetchAsyncAction.java From Elasticsearch with Apache License 2.0 | 5 votes |
SearchQueryThenFetchAsyncAction(ESLogger logger, SearchServiceTransportAction searchService, ClusterService clusterService, IndexNameExpressionResolver indexNameExpressionResolver, SearchPhaseController searchPhaseController, ThreadPool threadPool, SearchRequest request, ActionListener<SearchResponse> listener) { super(logger, searchService, clusterService, indexNameExpressionResolver, searchPhaseController, threadPool, request, listener); fetchResults = new AtomicArray<>(firstResults.length()); docIdsToLoad = new AtomicArray<>(firstResults.length()); }