org.elasticsearch.index.shard.DocsStats Java Examples

The following examples show how to use org.elasticsearch.index.shard.DocsStats. 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: CommonStats.java    From crate with Apache License 2.0 6 votes vote down vote up
public CommonStats(CommonStatsFlags flags) {
    CommonStatsFlags.Flag[] setFlags = flags.getFlags();

    for (CommonStatsFlags.Flag flag : setFlags) {
        switch (flag) {
            case Docs:
                docs = new DocsStats();
                break;
            case Store:
                store = new StoreStats();
                break;
            default:
                throw new IllegalStateException("Unknown Flag: " + flag);
        }
    }
}
 
Example #2
Source File: SearchIndexServiceImpl.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new search index statistics objects per specified parameters.
 *
 * @param settings the search index settings
 * @param docsStats the search index docs stats
 * @param indexCount the count of index
 *
 * @return the newly created search index statistics object
 */
protected SearchIndexStatistics createSearchIndexStatistics(Settings settings, DocsStats docsStats, long indexCount)
{
    SearchIndexStatistics searchIndexStatistics = new SearchIndexStatistics();

    Long creationDate = settings.getAsLong(IndexMetaData.SETTING_CREATION_DATE, -1L);
    if (creationDate.longValue() != -1L)
    {
        DateTime creationDateTime = new DateTime(creationDate, DateTimeZone.UTC);
        searchIndexStatistics.setIndexCreationDate(HerdDateUtils.getXMLGregorianCalendarValue(creationDateTime.toDate()));
    }

    searchIndexStatistics.setIndexNumberOfActiveDocuments(docsStats.getCount());
    searchIndexStatistics.setIndexNumberOfDeletedDocuments(docsStats.getDeleted());
    searchIndexStatistics.setIndexUuid(settings.get(IndexMetaData.SETTING_INDEX_UUID));
    searchIndexStatistics.setIndexCount(indexCount);

    return searchIndexStatistics;
}
 
Example #3
Source File: Engine.java    From crate with Apache License 2.0 6 votes vote down vote up
protected final DocsStats docsStats(IndexReader indexReader) {
    long numDocs = 0;
    long numDeletedDocs = 0;
    long sizeInBytes = 0;
    // we don't wait for a pending refreshes here since it's a stats call instead we mark it as accessed only which will cause
    // the next scheduled refresh to go through and refresh the stats as well
    for (LeafReaderContext readerContext : indexReader.leaves()) {
        // we go on the segment level here to get accurate numbers
        final SegmentReader segmentReader = Lucene.segmentReader(readerContext.reader());
        SegmentCommitInfo info = segmentReader.getSegmentInfo();
        numDocs += readerContext.reader().numDocs();
        numDeletedDocs += readerContext.reader().numDeletedDocs();
        try {
            sizeInBytes += info.sizeInBytes();
        } catch (IOException e) {
            logger.trace(() -> new ParameterizedMessage("failed to get size for [{}]", info.info.name), e);
        }
    }
    return new DocsStats(numDocs, numDeletedDocs, sizeInBytes);
}
 
Example #4
Source File: SearchIndexServiceImplTest.java    From herd with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateSearchIndexStatisticsNoIndexCreationDate()
{
    // Create a search index get settings response without the index creation date setting.
    ImmutableOpenMap<String, Settings> getIndexResponseSettings = ImmutableOpenMap.<String, Settings>builder()
        .fPut(SEARCH_INDEX_NAME, Settings.builder().put(IndexMetaData.SETTING_INDEX_UUID, SEARCH_INDEX_STATISTICS_INDEX_UUID).build()).build();

    // Mock an index docs stats object.
    DocsStats mockedDocsStats = mock(DocsStats.class);
    when(mockedDocsStats.getCount()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS);
    when(mockedDocsStats.getDeleted()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS);

    // Get a search index settings created.
    SearchIndexStatistics response = searchIndexServiceImpl.createSearchIndexStatistics(getIndexResponseSettings.get(SEARCH_INDEX_NAME), mockedDocsStats, 0l);

    // Verify the external calls.
    verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper,
        searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper);

    // Validate the returned object.
    assertEquals(new SearchIndexStatistics(NO_SEARCH_INDEX_STATISTICS_CREATION_DATE, SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS,
        SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS, SEARCH_INDEX_STATISTICS_INDEX_UUID, 0l), response);
}
 
Example #5
Source File: ClusterStatsIndices.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    indexCount = in.readVInt();
    shards = ShardStats.readShardStats(in);
    docs = DocsStats.readDocStats(in);
    store = StoreStats.readStoreStats(in);
    fieldData = FieldDataStats.readFieldDataStats(in);
    queryCache = QueryCacheStats.readQueryCacheStats(in);
    completion = CompletionStats.readCompletionStats(in);
    segments = SegmentsStats.readSegmentsStats(in);
    percolate = PercolateStats.readPercolateStats(in);
}
 
Example #6
Source File: SearchIndexServiceImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@Override
public SearchIndex getSearchIndex(SearchIndexKey searchIndexKey)
{
    // Perform validation and trim.
    validateSearchIndexKey(searchIndexKey);

    // Retrieve and ensure that a search index already exists with the specified key.
    SearchIndexEntity searchIndexEntity = searchIndexDaoHelper.getSearchIndexEntity(searchIndexKey);

    // Create the search index object from the persisted entity.
    SearchIndex searchIndex = createSearchIndexFromEntity(searchIndexEntity);
    DocsStats docsStats = indexFunctionsDao.getIndexStats(searchIndexKey.getSearchIndexName());
    // Retrieve index settings from the actual search index. A non-existing search index name results in a "no such index" internal server error.
    Settings settings = indexFunctionsDao.getIndexSettings(searchIndexKey.getSearchIndexName());

    String searchIndexType = searchIndexEntity.getType().getCode();
    String documentType = null;
    // Currently, only search index for business object definitions and tag are supported.
    if (SearchIndexTypeEntity.SearchIndexTypes.BUS_OBJCT_DFNTN.name().equalsIgnoreCase(searchIndexType))
    {
        documentType = configurationHelper.getProperty(ConfigurationValue.ELASTICSEARCH_BDEF_DOCUMENT_TYPE, String.class);
    }
    else if (SearchIndexTypeEntity.SearchIndexTypes.TAG.name().equalsIgnoreCase(searchIndexType))
    {

        documentType = configurationHelper.getProperty(ConfigurationValue.ELASTICSEARCH_TAG_DOCUMENT_TYPE, String.class);
    }
    else
    {
        throw new IllegalArgumentException(String.format("Search index type with code \"%s\" is not supported.", searchIndexType));
    }

    long indexCount = indexFunctionsDao.getNumberOfTypesInIndex(searchIndexKey.getSearchIndexName(), documentType);

    // Update the search index statistics.
    searchIndex.setSearchIndexStatistics(createSearchIndexStatistics(settings, docsStats, indexCount));

    return searchIndex;
}
 
Example #7
Source File: Engine.java    From crate with Apache License 2.0 5 votes vote down vote up
/**
 * Returns the {@link DocsStats} for this engine
 */
public DocsStats docStats() {
    // we calculate the doc stats based on the internal reader that is more up-to-date and not subject
    // to external refreshes. For instance we don't refresh an external reader if we flush and indices with
    // index.refresh_interval=-1 won't see any doc stats updates at all. This change will give more accurate statistics
    // when indexing but not refreshing in general. Yet, if a refresh happens the internal reader is refresh as well so we are
    // safe here.
    try (Engine.Searcher searcher = acquireSearcher("docStats", Engine.SearcherScope.INTERNAL)) {
        return docsStats(searcher.reader());
    }
}
 
Example #8
Source File: IndexFunctionsDaoImpl.java    From herd with Apache License 2.0 5 votes vote down vote up
@Override
public DocsStats getIndexStats(String indexName)
{
    Action getStats = new Stats.Builder().addIndex(indexName).build();
    JestResult jestResult = jestClientHelper.execute(getStats);
    Assert.isTrue(jestResult.isSucceeded(), jestResult.getErrorMessage());
    JsonObject statsJson = jestResult.getJsonObject().getAsJsonObject("indices").getAsJsonObject(indexName).getAsJsonObject("primaries");
    JsonObject docsJson = statsJson.getAsJsonObject("docs");
    return new DocsStats(docsJson.get("count").getAsLong(), docsJson.get("deleted").getAsLong());
}
 
Example #9
Source File: SysShardsExpressionsTest.java    From crate with Apache License 2.0 4 votes vote down vote up
private IndexShard mockIndexShard() {
    IndexService indexService = mock(IndexService.class);
    indexUUID = UUIDs.randomBase64UUID();
    Index index = new Index(indexName, indexUUID);
    ShardId shardId = new ShardId(indexName, indexUUID, 1);

    IndexShard indexShard = mock(IndexShard.class);
    when(indexService.index()).thenReturn(index);
    when(indexShard.shardId()).thenReturn(shardId);
    when(indexShard.state()).thenReturn(IndexShardState.STARTED);

    StoreStats storeStats = new StoreStats(123456L);
    when(indexShard.storeStats()).thenReturn(storeStats);

    Path dataPath = Paths.get("/dummy/" + indexUUID + "/" + shardId.id());
    when(indexShard.shardPath()).thenReturn(new ShardPath(false, dataPath, dataPath, shardId));

    DocsStats docsStats = new DocsStats(654321L, 0L, 200L);
    when(indexShard.docStats()).thenReturn(docsStats).thenThrow(IllegalIndexShardStateException.class);

    ShardRouting shardRouting = ShardRouting.newUnassigned(
        shardId, true, RecoverySource.PeerRecoverySource.INSTANCE, new UnassignedInfo(UnassignedInfo.Reason.INDEX_CREATED, "foo"));
    shardRouting = ShardRoutingHelper.initialize(shardRouting, "node1");
    shardRouting = ShardRoutingHelper.moveToStarted(shardRouting);
    shardRouting = ShardRoutingHelper.relocate(shardRouting, "node_X");
    when(indexShard.routingEntry()).thenReturn(shardRouting);
    when(indexShard.minimumCompatibleVersion()).thenReturn(Version.LATEST);

    RecoveryState recoveryState = mock(RecoveryState.class);
    when(indexShard.recoveryState()).thenReturn(recoveryState);
    RecoveryState.Index recoveryStateIndex = mock(RecoveryState.Index.class);
    RecoveryState.Timer recoveryStateTimer = mock(RecoveryState.Timer.class);
    when(recoveryState.getRecoverySource()).thenReturn(RecoverySource.PeerRecoverySource.INSTANCE);
    when(recoveryState.getIndex()).thenReturn(recoveryStateIndex);
    when(recoveryState.getStage()).thenReturn(RecoveryState.Stage.DONE);
    when(recoveryState.getTimer()).thenReturn(recoveryStateTimer);

    when(recoveryStateIndex.totalBytes()).thenReturn(2048L);
    when(recoveryStateIndex.reusedBytes()).thenReturn(1024L);
    when(recoveryStateIndex.recoveredBytes()).thenReturn(1024L);
    when(recoveryStateIndex.totalFileCount()).thenReturn(2);
    when(recoveryStateIndex.reusedFileCount()).thenReturn(1);
    when(recoveryStateIndex.recoveredFileCount()).thenReturn(1);
    when(recoveryStateTimer.time()).thenReturn(10000L);

    return indexShard;
}
 
Example #10
Source File: NodeIndicesStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public DocsStats getDocs() {
    return stats.getDocs();
}
 
Example #11
Source File: CommonStats.java    From crate with Apache License 2.0 4 votes vote down vote up
@Nullable
public DocsStats getDocs() {
    return this.docs;
}
 
Example #12
Source File: CommonStats.java    From crate with Apache License 2.0 4 votes vote down vote up
public CommonStats(StreamInput in) throws IOException {
    docs = in.readOptionalWriteable(DocsStats::new);
    store = in.readOptionalWriteable(StoreStats::new);
}
 
Example #13
Source File: TransportResizeAction.java    From crate with Apache License 2.0 4 votes vote down vote up
static CreateIndexClusterStateUpdateRequest prepareCreateIndexRequest(final ResizeRequest resizeRequest,
                                                                      final ClusterState state,
                                                                      final IntFunction<DocsStats> perShardDocStats,
                                                                      String sourceIndexName,
                                                                      String targetIndexName) {
    final CreateIndexRequest targetIndex = resizeRequest.getTargetIndexRequest();
    final IndexMetaData metaData = state.metaData().index(sourceIndexName);
    if (metaData == null) {
        throw new IndexNotFoundException(sourceIndexName);
    }
    final Settings targetIndexSettings = Settings.builder().put(targetIndex.settings())
        .normalizePrefix(IndexMetaData.INDEX_SETTING_PREFIX).build();
    final int numShards;
    if (IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.exists(targetIndexSettings)) {
        numShards = IndexMetaData.INDEX_NUMBER_OF_SHARDS_SETTING.get(targetIndexSettings);
    } else {
        assert resizeRequest.getResizeType() == ResizeType.SHRINK : "split must specify the number of shards explicitly";
        numShards = 1;
    }

    for (int i = 0; i < numShards; i++) {
        if (resizeRequest.getResizeType() == ResizeType.SHRINK) {
            Set<ShardId> shardIds = IndexMetaData.selectShrinkShards(i, metaData, numShards);
            long count = 0;
            for (ShardId id : shardIds) {
                DocsStats docsStats = perShardDocStats.apply(id.id());
                if (docsStats != null) {
                    count += docsStats.getCount();
                }
                if (count > IndexWriter.MAX_DOCS) {
                    throw new IllegalStateException("Can't merge index with more than [" + IndexWriter.MAX_DOCS
                        + "] docs - too many documents in shards " + shardIds);
                }
            }
        } else {
            Objects.requireNonNull(IndexMetaData.selectSplitShard(i, metaData, numShards));
            // we just execute this to ensure we get the right exceptions if the number of shards is wrong or less then etc.
        }
    }

    if (IndexMetaData.INDEX_ROUTING_PARTITION_SIZE_SETTING.exists(targetIndexSettings)) {
        throw new IllegalArgumentException("cannot provide a routing partition size value when resizing an index");
    }
    if (IndexMetaData.INDEX_NUMBER_OF_ROUTING_SHARDS_SETTING.exists(targetIndexSettings)) {
        throw new IllegalArgumentException("cannot provide index.number_of_routing_shards on resize");
    }
    if (IndexSettings.INDEX_SOFT_DELETES_SETTING.exists(metaData.getSettings()) &&
        IndexSettings.INDEX_SOFT_DELETES_SETTING.get(metaData.getSettings()) &&
        IndexSettings.INDEX_SOFT_DELETES_SETTING.exists(targetIndexSettings) &&
        IndexSettings.INDEX_SOFT_DELETES_SETTING.get(targetIndexSettings) == false) {
        throw new IllegalArgumentException("Can't disable [index.soft_deletes.enabled] setting on resize");
    }
    String cause = resizeRequest.getResizeType().name().toLowerCase(Locale.ROOT) + "_index";
    targetIndex.cause(cause);
    Settings.Builder settingsBuilder = Settings.builder().put(targetIndexSettings);
    settingsBuilder.put("index.number_of_shards", numShards);
    targetIndex.settings(settingsBuilder);

    return new CreateIndexClusterStateUpdateRequest(cause, targetIndex.index(), targetIndexName, true)
            // mappings are updated on the node when creating in the shards, this prevents race-conditions since all mapping must be
            // applied once we took the snapshot and if somebody messes things up and switches the index read/write and adds docs we
            // miss the mappings for everything is corrupted and hard to debug
            .ackTimeout(targetIndex.timeout())
            .masterNodeTimeout(targetIndex.masterNodeTimeout())
            .settings(targetIndex.settings())
            .aliases(targetIndex.aliases())
            .waitForActiveShards(targetIndex.waitForActiveShards())
            .recoverFrom(metaData.getIndex())
            .resizeType(resizeRequest.getResizeType())
            .copySettings(resizeRequest.getCopySettings() == null ? false : resizeRequest.getCopySettings());
}
 
Example #14
Source File: GraphiteReporter.java    From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License 4 votes vote down vote up
private void sendDocsStats(String name, DocsStats docsStats) {
    sendInt(name, "count", docsStats.getCount());
    sendInt(name, "deleted", docsStats.getDeleted());
}
 
Example #15
Source File: SearchIndexServiceTest.java    From herd with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetSearchIndex()
{
    // Create a search index key.
    SearchIndexKey searchIndexKey = new SearchIndexKey(SEARCH_INDEX_NAME);

    // Create the search index entity.
    SearchIndexEntity searchIndexEntity = createTestSearchIndexEntity();

    // Mock some of the external call responses.
    @SuppressWarnings("unchecked")
    DocsStats mockedDocsStats = mock(DocsStats.class);
    java.util.Map<String, String> map = new HashMap<>();
    map.put(IndexMetaData.SETTING_INDEX_UUID, SEARCH_INDEX_STATISTICS_INDEX_UUID);
    map.put(IndexMetaData.SETTING_CREATION_DATE,  Long.toString(SEARCH_INDEX_STATISTICS_CREATION_DATE.toGregorianCalendar().getTimeInMillis()));

    Settings settings = Settings.builder().put(map).build();
    // Mock the external calls.
    when(alternateKeyHelper.validateStringParameter("Search index name", SEARCH_INDEX_NAME)).thenReturn(SEARCH_INDEX_NAME);
    when(searchIndexDaoHelper.getSearchIndexEntity(searchIndexKey)).thenReturn(searchIndexEntity);

    when(indexFunctionsDao.getIndexSettings(SEARCH_INDEX_NAME)).thenReturn(settings);
    when(indexFunctionsDao.getIndexStats(SEARCH_INDEX_NAME)).thenReturn(mockedDocsStats);
    when(mockedDocsStats.getCount()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS);
    when(mockedDocsStats.getDeleted()).thenReturn(SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS);
    when(configurationHelper.getProperty(ConfigurationValue.ELASTICSEARCH_BDEF_DOCUMENT_TYPE, String.class)).thenReturn("doc");
    when(indexFunctionsDao.getNumberOfTypesInIndex(any(), any())).thenReturn(0l);

    // Get a search index.
    SearchIndex response = searchIndexService.getSearchIndex(searchIndexKey);

    // Verify the external calls.
    verify(alternateKeyHelper).validateStringParameter("Search index name", SEARCH_INDEX_NAME);
    verify(searchIndexDaoHelper).getSearchIndexEntity(searchIndexKey);
    verify(mockedDocsStats).getCount();
    verify(mockedDocsStats).getDeleted();
    verify(indexFunctionsDao).getIndexSettings(SEARCH_INDEX_NAME);
    verify(indexFunctionsDao).getIndexStats(SEARCH_INDEX_NAME);
    verify(configurationHelper).getProperty(ConfigurationValue.ELASTICSEARCH_BDEF_DOCUMENT_TYPE, String.class);
    verify(indexFunctionsDao).getNumberOfTypesInIndex(any(), any());

    verifyNoMoreInteractions(alternateKeyHelper, businessObjectDefinitionDao, businessObjectDefinitionHelper, configurationDaoHelper, configurationHelper,
        indexFunctionsDao, searchIndexDao, searchIndexDaoHelper, searchIndexHelperService, searchIndexStatusDaoHelper, searchIndexTypeDaoHelper);

    //response.getSearchIndexStatistics().setIndexCreationDate(SEARCH_INDEX_STATISTICS_CREATION_DATE);
    // Validate the returned object.
    assertEquals(new SearchIndex(searchIndexKey, SEARCH_INDEX_TYPE_BDEF, SEARCH_INDEX_STATUS, SEARCH_INDEX_DEFAULT_ACTIVE_FLAG,
        new SearchIndexStatistics(SEARCH_INDEX_STATISTICS_CREATION_DATE, SEARCH_INDEX_STATISTICS_NUMBER_OF_ACTIVE_DOCUMENTS,
            SEARCH_INDEX_STATISTICS_NUMBER_OF_DELETED_DOCUMENTS, SEARCH_INDEX_STATISTICS_INDEX_UUID, 0l), USER_ID, CREATED_ON, UPDATED_ON), response);
}
 
Example #16
Source File: ClusterStatsIndices.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public DocsStats getDocs() {
    return docs;
}
 
Example #17
Source File: ClusterStatsIndices.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public ClusterStatsIndices(ClusterStatsNodeResponse[] nodeResponses) {
    ObjectObjectHashMap<String, ShardStats> countsPerIndex = new ObjectObjectHashMap<>();

    this.docs = new DocsStats();
    this.store = new StoreStats();
    this.fieldData = new FieldDataStats();
    this.queryCache = new QueryCacheStats();
    this.completion = new CompletionStats();
    this.segments = new SegmentsStats();
    this.percolate = new PercolateStats();

    for (ClusterStatsNodeResponse r : nodeResponses) {
        for (org.elasticsearch.action.admin.indices.stats.ShardStats shardStats : r.shardsStats()) {
            ShardStats indexShardStats = countsPerIndex.get(shardStats.getShardRouting().getIndex());
            if (indexShardStats == null) {
                indexShardStats = new ShardStats();
                countsPerIndex.put(shardStats.getShardRouting().getIndex(), indexShardStats);
            }

            indexShardStats.total++;

            CommonStats shardCommonStats = shardStats.getStats();

            if (shardStats.getShardRouting().primary()) {
                indexShardStats.primaries++;
                docs.add(shardCommonStats.docs);
            }
            store.add(shardCommonStats.store);
            fieldData.add(shardCommonStats.fieldData);
            queryCache.add(shardCommonStats.queryCache);
            completion.add(shardCommonStats.completion);
            segments.add(shardCommonStats.segments);
            percolate.add(shardCommonStats.percolate);
        }
    }

    shards = new ShardStats();
    indexCount = countsPerIndex.size();
    for (ObjectObjectCursor<String, ShardStats> indexCountsCursor : countsPerIndex) {
        shards.addIndexShardCount(indexCountsCursor.value);
    }
}
 
Example #18
Source File: CommonStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public void readFrom(StreamInput in) throws IOException {
    if (in.readBoolean()) {
        docs = DocsStats.readDocStats(in);
    }
    if (in.readBoolean()) {
        store = StoreStats.readStoreStats(in);
    }
    if (in.readBoolean()) {
        indexing = IndexingStats.readIndexingStats(in);
    }
    if (in.readBoolean()) {
        get = GetStats.readGetStats(in);
    }
    if (in.readBoolean()) {
        search = SearchStats.readSearchStats(in);
    }
    if (in.readBoolean()) {
        merge = MergeStats.readMergeStats(in);
    }
    if (in.readBoolean()) {
        refresh = RefreshStats.readRefreshStats(in);
    }
    if (in.readBoolean()) {
        flush = FlushStats.readFlushStats(in);
    }
    if (in.readBoolean()) {
        warmer = WarmerStats.readWarmerStats(in);
    }
    if (in.readBoolean()) {
        queryCache = QueryCacheStats.readQueryCacheStats(in);
    }
    if (in.readBoolean()) {
        fieldData = FieldDataStats.readFieldDataStats(in);
    }
    if (in.readBoolean()) {
        percolate = PercolateStats.readPercolateStats(in);
    }
    if (in.readBoolean()) {
        completion = CompletionStats.readCompletionStats(in);
    }
    if (in.readBoolean()) {
        segments = SegmentsStats.readSegmentsStats(in);
    }
    if (in.readBoolean()) {
        dlStats = DLStats.readDLStats(in);
    }
    if (in.readBoolean()) {
        reindexStats = ReindexStats.readReindexStats(in);
    }
    translog = in.readOptionalStreamable(new TranslogStats());
    suggest = in.readOptionalStreamable(new SuggestStats());
    requestCache = in.readOptionalStreamable(new RequestCacheStats());
    recoveryStats = in.readOptionalStreamable(new RecoveryStats());
}
 
Example #19
Source File: CommonStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public DocsStats getDocs() {
    return this.docs;
}
 
Example #20
Source File: CommonStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public CommonStats(CommonStatsFlags flags) {
    CommonStatsFlags.Flag[] setFlags = flags.getFlags();

    for (CommonStatsFlags.Flag flag : setFlags) {
        switch (flag) {
            case Docs:
                docs = new DocsStats();
                break;
            case Store:
                store = new StoreStats();
                break;
            case Indexing:
                indexing = new IndexingStats();
                break;
            case Get:
                get = new GetStats();
                break;
            case Search:
                search = new SearchStats();
                break;
            case Merge:
                merge = new MergeStats();
                break;
            case Refresh:
                refresh = new RefreshStats();
                break;
            case Flush:
                flush = new FlushStats();
                break;
            case Warmer:
                warmer = new WarmerStats();
                break;
            case QueryCache:
                queryCache = new QueryCacheStats();
                break;
            case FieldData:
                fieldData = new FieldDataStats();
                break;
            case Completion:
                completion = new CompletionStats();
                break;
            case Segments:
                segments = new SegmentsStats();
                break;
            case Percolate:
                percolate = new PercolateStats();
                break;
            case Translog:
                translog = new TranslogStats();
                break;
            case Suggest:
                suggest = new SuggestStats();
                break;
            case RequestCache:
                requestCache = new RequestCacheStats();
                break;
            case Recovery:
                recoveryStats = new RecoveryStats();
                break;
            case DL:
                dlStats = new DLStats();
                break;
            case Reindex:
                reindexStats = new ReindexStats();
                break;
            default:
                throw new IllegalStateException("Unknown Flag: " + flag);
        }
    }
}
 
Example #21
Source File: IndexFunctionsDao.java    From herd with Apache License 2.0 2 votes vote down vote up
/**
 * get docs stats
 * @param indexName index name
 * @return docs stats
 */
public DocsStats getIndexStats(String indexName);