How to check health of cluster and node?
Start ElasticSearch and Kibana, and then open Kibana dashboard (you can open it with this URL http://localhost:5601/app/kibana#/dev_tools/console)
to check health of cluster execute:
GET _cat/health?v
to check health of node execute:
GET _cat/nodes?v
to check how many indices we have, we can execute below command:
GET _cat/indices?v
to create a new index (i.e a Database)
PUT /sales
Let's add a Document(i.e table) in the index, which we just created.
PUT /sales/order/123
{
"orderId":"123",
"orderAmount":"500"
}
To Get the order, which we just created
GET sales/order/123
To delete the index (ie Database)
DELETE sales
How can we load bulk data in ElasticSearch?
Let's say we have a file which has bulk data and the name of that file is bulkDataFile. To can do the bulk load by using below CURL command:
curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@bulkDataFile"; echo
We can also do the same thing from Kibana Console, to do this execute below command from the console:
POST _bulk
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "1" } }
{ "col1" : "val1" }
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "2" } }
{ "col1" : "val2"}
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "3" } }
{ "col1" : "val3" }
To verify whether the data is uploaded or not, you can execute below command:
GET my-test-console
GET my-test-console/_type/1
-K Himaanshu Shuklaa..
Start ElasticSearch and Kibana, and then open Kibana dashboard (you can open it with this URL http://localhost:5601/app/kibana#/dev_tools/console)
to check health of cluster execute:
GET _cat/health?v
to check health of node execute:
GET _cat/nodes?v
to check how many indices we have, we can execute below command:
GET _cat/indices?v
to create a new index (i.e a Database)
PUT /sales
Let's add a Document(i.e table) in the index, which we just created.
PUT /sales/order/123
{
"orderId":"123",
"orderAmount":"500"
}
To Get the order, which we just created
GET sales/order/123
To delete the index (ie Database)
DELETE sales
How can we load bulk data in ElasticSearch?
Let's say we have a file which has bulk data and the name of that file is bulkDataFile. To can do the bulk load by using below CURL command:
curl -s -H "Content-Type: application/x-ndjson" -XPOST localhost:9200/_bulk --data-binary "@bulkDataFile"; echo
We can also do the same thing from Kibana Console, to do this execute below command from the console:
POST _bulk
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "1" } }
{ "col1" : "val1" }
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "2" } }
{ "col1" : "val2"}
{ "index" : { "_index" : "my-test-console", "_type" : "my-type", "_id" : "3" } }
{ "col1" : "val3" }
To verify whether the data is uploaded or not, you can execute below command:
GET my-test-console
GET my-test-console/_type/1
-K Himaanshu Shuklaa..
No comments:
Post a Comment