Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can We Retrieve Previous _source Docs with Elastic Search Versions

People also ask

Does Elasticsearch store data in memory?

Elasticsearch indexes are just files and they effectively cached in RAM by system. Usually if you have enough RAM Elasticsearch should work as fast as possible, especially for GET queries.

Where are Elasticsearch documents stored?

According to the documentation the data is stored in a folder called "data" in the elastic search root directory.

Does Elasticsearch overwrite?

In Elasticsearch, to replace a document you simply have to index a document with the same ID and it will be replaced automatically. If you would like to update a document you can either do a scripted update, a partial update or both.

Is Elasticsearch document store?

Elasticsearch is a distributed document store. Instead of storing information as rows of columnar data, Elasticsearch stores complex data structures that have been serialized as JSON documents.


No, you can't do this using the builtin versioning. All that does is to store the current version number to prevent you applying updates out of order.

If you wanted to keep multiple versions available, then you'd have to implement that yourself. Depending on how many versions you are likely to want to store, you could take three approaches:

For low volume changes:

1) store older versions within the same document

{ text: "foo bar",
  date:  "2011-11-01",
  previous: [
      { date: '2011-10-01', content: { text: 'Foo Bar' }},
      { date: '2011-09-01', content: { text: 'Foo-bar!' }},
  ]
}

For high volume changes:

2) add a current flag:

{
   doc_id:  123,
   version: 3,
   text:    "foo bar",
   date:    "2011-11-01",
   current: true
}

{
   doc_id:  123,
   version: 2,
   text:    "Foo Bar",
   date:    "2011-10-01",
   current: false
}

3) Same as (2) above, but store the old versions in a separate index, so keeping your "live" index, which will be used for the majority of your queries, small and more performant.