简体   繁体   中英

Enter multiple documents to same the same index in elastic search

I'm new to elasticsearch, what I want to achieve is to insert multiple documents, that is, values to the same id in the index. Is it possible? When I try it the documents are getting updated. Let me know if it's possible ,thanks.

You can use the bulk-API to store multiple documents at once, but you can not store different documents with the same ID. Maybe you can achieve what you need by using the versioning feature .

What you are describing sounds like the Array Datatype . Per the ES documentation, you can put an array of strings into one field like so:

PUT my_index/_doc/1
{
  "message": "some arrays in this document...",
  "tags":  [ "elasticsearch", "wow" ], 
  "lists": [ 
    {
      "name": "prog_list",
      "description": "programming list"
    },
    {
      "name": "cool_list",
      "description": "cool stuff list"
    }
  ]
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM