How to create document ID and retrieve it in Kibana
To Create Document ID and Retrieve it in Kibana
We know elastic search comprises of nodes and clusters which are the center of the elastic search architecture. You can seamlessly create an index and add a few documents in Kibana and this tutorial will help you do that in an easy way.
Quick guide:
Node is a server that stores part of data
Cluster is a collection of nodes
Nodes support searching new data and indexing, manipulating and so on
Create Document ID
In our previous session, we have seen the how to create an index and add documents, if you have missed it, you can check it out from here. In this session, we will see how to create document ID and retrieve documents.
First, go to your Kibana application web interface. You need to create an index and add documents by following the below syntax.
PUT /title?pretty
In the above syntax:
- title denotes the name of index
- pretty denotes flag
Now, you shall create a document for the newly created index by following the below syntax.
For the documents, you need to use POST
POST /title /default/
{
Json objects
}
In the above syntax
- title denotes index name
- default denotes type name
This results in default document ID.
Next, assign ID for the created document by syntax.
POST /title /default/1
{
Json objects
}
In the above syntax:
1 denotes Id assigned for the document.
Finally, retrieve the document with the Id created.
GET /title/default/1
The result shows certain meta fields prefixed with an underscore.
_index for indicating your index name
_id for indicating Document ID
_type for indicating Type of your document.
_source for indicating consists of your document data which was added as json object.
found refers to which while retrieving your document your document is found without any glitches hence status remains true.
Comments ( 0 )
No comments available