Getting Indexed Document

Now that we have document indexed, let's access it and observe how it looks after getting stored in Elasticsearch.


In order to perform this, we would access the document by Id. Getting document by Id is a very important way to access the document from Elasticsearch as it is always real-time, and does not depend on refresh cycles.

A general syntax to access the document by Id is GET {index-name}/{type}/{id}, as shown here:

GET datalake/contacts/101

Figure 26: Query to Get Document By Id

As we see in the preceding snapshot:

  1. The document is created with the same _id attribute as provided while indexing the document.
  2. The attribute id, on the other hand, is like any other attribute and is not the _id attribute that Elasticsearch uses for lookup.
  3. The version is 1, indicating that the document is just created and has not been updated. With every update, this version will increment.
  1. The index name is datalake and type is contacts.
  2. The _source contains the entire document provided for indexing. This is optional but is enabled by default. This is useful to keep the entire document along with the indexed fields.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.12.186