private void indexObject(
            final String index, final String docType, final String docId, final Object doc) {

        byte[] docBytes;
        try {
            docBytes = objectMapper.writeValueAsBytes(doc);
        } catch (JsonProcessingException e) {
            LOGGER.error("Failed to convert {} '{}' to byte string", docType, docId);
            return;
        }

        IndexRequest request = new IndexRequest(index, docType, docId);
        request.source(docBytes, XContentType.JSON);

        if (bulkRequests.get(docType) == null) {
            bulkRequests.put(
                    docType, new BulkRequests(System.currentTimeMillis(), new BulkRequest()));
        }

        bulkRequests.get(docType).getBulkRequest().add(request);
        if (bulkRequests.get(docType).getBulkRequest().numberOfActions() >= this.indexBatchSize) {
            indexBulkRequest(docType);
        }
    }
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