There is a need to replace existing elements with new ones, approximately 10 times per second.Naturally, you can first search and delete existing ones, and then add new ones, but this seems far from the best solution(due to the fact that I am a student and there is no particularly powerful iron).

"Primary key" or just a unique field has a string type("string") and represents a kind of unique sequence(something like a hash) that belongs to a strictly defined object.

Yes, I found this:
"_ id": {
	"path":"id"
}

but it is depricated since version 1.5, I have 2.2.

1 Answers 1

I could not understand why replacing the _id field with something else will solve your problem.

First, the _id can be determined by the client.Learn more: ty.
If you don’t like the id generated by the elastic, just pass your own when creating the document.

First, ES supports grouping operations in one query if the performance problem is:
https://www.elastic.co/guide/en/elasticsearch/refe...

An example of creating a document with a predefined id(in this case, 12345):

curl -XPUT 0.0.0.0:9200/index_name/type_name/12345/-d'{
   "hey":"there"
}'
  • Your answer is almost correct. At the time of writing the question, I did not know that it was possible to simply take and transmit my"_id" without prior notification of the database (i.e., it’s wrong and illogical, just like that, I thought and took and passed on what I wanted before I found a solution). Supplement your answer with an example so that I could mark it with a decision. – Super Shrike Apr 22 '16 at 13:35
  • [[loly]]: No, this is the norm. In the relational database, too, no one forces you to use autoincrement for id, you can operate with them as you please. I added an example and a link to the documentation. – Japanese41 May 16 '16 at 21:50