@CheckForNull private static QueryBuilder createViewFilter(Collection<String> viewUuids) { if (viewUuids.isEmpty()) { return null; } BoolQueryBuilder viewsFilter = boolQuery(); for (String viewUuid : viewUuids) { viewsFilter.should(QueryBuilders.termsLookupQuery(FIELD_ISSUE_BRANCH_UUID, new TermsLookup( ViewIndexDefinition.INDEX_TYPE_VIEW.getIndex(), ViewIndexDefinition.INDEX_TYPE_VIEW.getType(), viewUuid, ViewIndexDefinition.FIELD_PROJECTS))); } return viewsFilter; }
/** * Adds a pending delete for the given index. */ public void addPendingDelete(Index index, IndexSettings settings) { PendingDelete pendingDelete = new PendingDelete(index, settings); addPendingDelete(index, pendingDelete); }
@Override public void onStoreClosed(ShardId shardId) { indicesQueryCache.onClose(shardId); } };
public static void toProtobuf(NodeStats stats, ProtobufSystemInfo.Section.Builder protobuf) { setAttribute(protobuf, "CPU Usage (%)", stats.getProcess().getCpu().getPercent()); setAttribute(protobuf, "Disk Available", byteCountToDisplaySize(stats.getFs().getTotal().getAvailable().getBytes())); setAttribute(protobuf, "Store Size", byteCountToDisplaySize(stats.getIndices().getStore().getSizeInBytes())); setAttribute(protobuf, "Open File Descriptors", stats.getProcess().getOpenFileDescriptors()); setAttribute(protobuf, "Max File Descriptors", stats.getProcess().getMaxFileDescriptors()); setAttribute(protobuf, "Spinning", stats.getFs().getTotal().getSpins()); setAttribute(protobuf, "JVM Heap Usage", formatPercent(stats.getJvm().getMem().getHeapUsedPercent())); setAttribute(protobuf, "JVM Heap Used", byteCountToDisplaySize(stats.getJvm().getMem().getHeapUsed().getBytes())); setAttribute(protobuf, "JVM Heap Max", byteCountToDisplaySize(stats.getJvm().getMem().getHeapMax().getBytes())); setAttribute(protobuf, "JVM Non Heap Used", byteCountToDisplaySize(stats.getJvm().getMem().getNonHeapUsed().getBytes())); setAttribute(protobuf, "JVM Threads", stats.getJvm().getThreads().getCount()); setAttribute(protobuf, "Field Data Memory", byteCountToDisplaySize(stats.getIndices().getFieldData().getMemorySizeInBytes())); setAttribute(protobuf, "Field Data Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getLimit())); setAttribute(protobuf, "Field Data Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.FIELDDATA).getEstimated())); setAttribute(protobuf, "Request Circuit Breaker Limit", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getLimit())); setAttribute(protobuf, "Request Circuit Breaker Estimation", byteCountToDisplaySize(stats.getBreaker().getStats(CircuitBreaker.REQUEST).getEstimated())); setAttribute(protobuf, "Query Cache Memory", byteCountToDisplaySize(stats.getIndices().getQueryCache().getMemorySizeInBytes())); setAttribute(protobuf, "Request Cache Memory", byteCountToDisplaySize(stats.getIndices().getRequestCache().getMemorySizeInBytes())); }
public static NodeIndicesStats readIndicesStats(StreamInput in) throws IOException { NodeIndicesStats stats = new NodeIndicesStats(); stats.readFrom(in); return stats; }
void clear(CacheEntity entity) { keysToClean.add(new CleanupKey(entity, null)); cleanCache(); }
public InvalidIndexNameException(String name, String desc) { super("Invalid index name [" + name + "], " + desc); setIndex(name); } public InvalidIndexNameException(Index index, String name, String desc) {
public IndexCreationException(String index, Throwable cause) { super("failed to create index [{}]", cause, index); setIndex(index); }
public AliasFilterParsingException(Index index, String name, String desc, Throwable ex) { super("[" + name + "], " + desc, ex); setIndex(index); }
public IndexClosedException(Index index) { super("closed"); setIndex(index); }
public InvalidAliasNameException(Index index, String name, String desc) { super("Invalid alias name [{}], {}", name, desc); setIndex(index); }
public IndexPrimaryShardNotAllocatedException(Index index) { super("primary not allocated post api"); setIndex(index); }
@Override public void postDelete(ShardId shardId, Engine.Delete delete, Engine.DeleteResult result) { recordOperationBytes(delete, result); }
/** force checker to run now */ void forceCheck() { statusChecker.run(); }
@Override public Weight doCache(Weight weight, QueryCachingPolicy policy) { return indicesQueryCache.doCache(weight, policy); }
private void deleteIndexStore(String reason, Index index, IndexSettings indexSettings) throws IOException { deleteIndexStoreIfDeletionAllowed(reason, index, indexSettings, DEFAULT_INDEX_DELETION_PREDICATE); }
/** * Returns a new {@link QueryRewriteContext} with the given {@code now} provider */ public QueryRewriteContext getRewriteContext(LongSupplier nowInMillis) { return indicesService.getRewriteContext(nowInMillis); }
private SearchRequestBuilder prepareNonClosedVulnerabilitiesAndHotspotSearch(String projectUuid, boolean isViewOrApp) { BoolQueryBuilder componentFilter = boolQuery(); if (isViewOrApp) { componentFilter.filter(QueryBuilders.termsLookupQuery(FIELD_ISSUE_BRANCH_UUID, new TermsLookup( ViewIndexDefinition.INDEX_TYPE_VIEW.getIndex(), ViewIndexDefinition.INDEX_TYPE_VIEW.getType(), projectUuid, ViewIndexDefinition.FIELD_PROJECTS))); } else { componentFilter.filter(termQuery(FIELD_ISSUE_BRANCH_UUID, projectUuid)); } return client.prepareSearch(INDEX_TYPE_ISSUE) .setQuery( componentFilter .filter(termsQuery(FIELD_ISSUE_TYPE, RuleType.SECURITY_HOTSPOT.name(), RuleType.VULNERABILITY.name())) .mustNot(termQuery(FIELD_ISSUE_STATUS, Issue.STATUS_CLOSED))) .setSize(0); }
public InvalidIndexNameException(Index index, String name, String desc) { super("Invalid index name [" + name + "], " + desc); setIndex(index); }
@Override public void postIndex(ShardId shardId, Engine.Index index, Engine.IndexResult result) { recordOperationBytes(index, result); }