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:
- The document is created with the same
_id
attribute as provided while indexing the document. - The attribute id, on the other hand, is like any other attribute and is not the
_id
attribute that Elasticsearch uses for lookup. - The version is 1, indicating that the document is just created and has not been updated. With every update, this version will increment.
- The index name is
datalake
and type iscontacts
. - The
_source
contains the entire document provided...