D
D
Daria Motorina2020-09-01 17:39:59
elasticsearch
Daria Motorina, 2020-09-01 17:39:59

Is the ability to set the type indirectly in Elasticsearch 7.9 a bug or a feature?

I fiddled with tutorials on an outdated version of Elasticsearch and compared it with the current documentation and a question arose.

According to the documentation, there can be only one type in the index, the standard one (_doc), the addition of the type is already deprecated .
If we added mapping to an empty index, then we can only add a document through a request POST /<index>/_doc.
Why, at the same time, can we PUT /<index>/<type>/<id>add a type to an empty index through a query?
Is this backwards compatibility or a bug?
Request example:

curl --location --request PUT 'http://localhost:9200/example1/product/1' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "example title",
  "author": "example author",
  "category": "books"
}

Answer to it:
{
    "_index": "example1",
    "_type": "product",
    "_id": "33",
    "_version": 1,
    "result": "created",
    "_shards": {
        "total": 2,
        "successful": 1,
        "failed": 0
    },
    "_seq_no": 7,
    "_primary_term": 9
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2020-09-01
@glaphire

This is not exactly backward compatibility, just the old crutches from multiple types in the same index, which will probably be removed over time.
I suspect that _doc will soon leave us...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question