Elasticsearch * Reference1.7 Introduce

882 查看

Elasticsearch Introduce

Reference1.7 version

1. Getting Started

Restful API

Cluster health

curl 'localhost:9200/_cat/health?v'
curl 'localhost:9200/_cat/nodes?v'

List ALL Indices

curl 'localhost:9200/_cat/indices?v'

Create an Index

curl -XPUT 'localhost:9200/customer?pretty'

Put data to Index

Our JSON document: { "name": "John Doe" }

curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '
{
  "name": "John Doe"
}'

And the response:

curl -XPUT 'localhost:9200/customer/external/1?pretty' -d '
{
  "name": "John Doe"
}'
{
  "_index" : "customer",
  "_type" : "external",
  "_id" : "1",
  "_version" : 1,
  "created" : true
}

Get Data from Index

curl -XGET 'localhost:9200/customer/external/1?pretty'

Detele an Index

curl -XDELETE 'localhost:9200/customer'

Restful Cmd @elasticsearch

curl -X<REST Verb> <Node>:<Port>/<Index>/<Type>/<ID>

more_detail_info_for_elasticsearch

Java API

more_info