Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ElasticSearch: Specifying types in bulk requests is deprecated

I am getting a warning:

"[types removal] Specifying types in bulk requests is deprecated."]

What do I do wrong? This is my code:

    BulkRequest request = new BulkRequest();

    for(Item item : items) {
        IndexRequest indexRequest = new IndexRequest(INDEX_NAME, DOC_TYPE, item.getIdentifier());
        indexRequest
                .opType(DocWriteRequest.OpType.INDEX) // Index the source. If there an existing document with the id, it will be replaced.
                .source(JsonUtility.toJson(item), XContentType.JSON);

        request.add(indexRequest);
    }

    elastic.bulk(request, RequestOptions.DEFAULT);
like image 675
user3489820 Avatar asked Jun 02 '19 22:06

user3489820


1 Answers

The mapping type was removed in Elasticsearch 8 and is deprecated in Elasticsearch 7.

No Elasticsearch version is mentioned in your question, but you can read more about the schedule for removal of mapping types, and react accordingly.

like image 107
ch33hau Avatar answered Oct 26 '22 08:10

ch33hau