private long getObjectCounts(String structuredQuery, String freeTextQuery, String docType)
            throws ParserException, IOException {
        QueryBuilder queryBuilder = boolQueryBuilder(structuredQuery, freeTextQuery);
        SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
        sourceBuilder.query(queryBuilder);

        String indexName = getIndexName(docType);
        CountRequest countRequest = new CountRequest(new String[] {indexName}, sourceBuilder);
        CountResponse countResponse =
                elasticSearchClient.count(countRequest, RequestOptions.DEFAULT);
        return countResponse.getCount();
    }
Tries to find objects for a given query in an index.

@param indexName The name of the index.
@param queryBuilder The query to use for searching.
@param start The start to use.
@param size The total return size.
@param sortOptions A list of string options to sort in the form VALUE:ORDER; where ORDER is
    optional and can be either ASC OR DESC.
@param docType The document type to searchObjectIdsViaExpression for.
@return The SearchResults which includes the count and objects that were found.
@throws IOException If we cannot communicate with ES.
es6-persistence/src/main/java/com/netflix/conductor/es6/dao/index/ElasticSearchRestDAOV6.java