org.elasticsearch.index.search.stats.SearchStats Java Examples

The following examples show how to use org.elasticsearch.index.search.stats.SearchStats. 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: Elasticsearch7SearchIndexTest.java    From vertexium with Apache License 2.0 5 votes vote down vote up
private long getNumQueries() {
    NodesStatsResponse nodeStats = new NodesStatsRequestBuilder(elasticsearchResource.getClient(), NodesStatsAction.INSTANCE).get();

    List<NodeStats> nodes = nodeStats.getNodes();
    assertEquals(1, nodes.size());

    SearchStats searchStats = nodes.get(0).getIndices().getSearch();
    return searchStats.getTotal().getQueryCount();
}
 
Example #2
Source File: Elasticsearch5SearchIndexTest.java    From vertexium with Apache License 2.0 5 votes vote down vote up
private long getNumQueries() {
    NodesStatsResponse nodeStats = NodesStatsAction.INSTANCE.newRequestBuilder(elasticsearchResource.getClient()).get();

    List<NodeStats> nodes = nodeStats.getNodes();
    assertEquals(1, nodes.size());

    SearchStats searchStats = nodes.get(0).getIndices().getSearch();
    return searchStats.getTotal().getQueryCount();
}
 
Example #3
Source File: GraphiteReporter.java    From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License 5 votes vote down vote up
private void sendSearchStats(String type, SearchStats searchStats) {
    SearchStats.Stats totalSearchStats = searchStats.getTotal();
    sendSearchStatsStats(type + "._all", totalSearchStats);

    if (searchStats.getGroupStats() != null ) {
        for (Map.Entry<String, SearchStats.Stats> statsEntry : searchStats.getGroupStats().entrySet()) {
            sendSearchStatsStats(type + "." + statsEntry.getKey(), statsEntry.getValue());
        }
    }
}
 
Example #4
Source File: GraphiteReporter.java    From elasticsearch-graphite-plugin with Do What The F*ck You Want To Public License 5 votes vote down vote up
private void sendSearchStatsStats(String type, SearchStats.Stats searchStats) {
    sendInt(type, "queryCount", searchStats.getQueryCount());
    sendInt(type, "queryTimeInMillis", searchStats.getQueryTimeInMillis());
    sendInt(type, "queryCurrent", searchStats.getQueryCurrent());
    sendInt(type, "fetchCount", searchStats.getFetchCount());
    sendInt(type, "fetchTimeInMillis", searchStats.getFetchTimeInMillis());
    sendInt(type, "fetchCurrent", searchStats.getFetchCurrent());
}
 
Example #5
Source File: NodeIndicesStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public SearchStats getSearch() {
    return stats.getSearch();
}
 
Example #6
Source File: IndexShard.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
public SearchStats searchStats(String... groups) {
    return searchService.stats(groups);
}
 
Example #7
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 #8
Source File: CommonStats.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Nullable
public SearchStats getSearch() {
    return search;
}
 
Example #9
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());
}