1. 程式人生 > >elasticsearch(5) curl 操作elasticsearch

elasticsearch(5) curl 操作elasticsearch

lib 技術分享 info ice fly ica title sea set

創建索引之前可以對索引做初始化操作, 比如指定shards數量以及replicas的數量。 library為索引的名稱

CURL -XPUT ‘http://192.168.1.10:9200/library/‘ -d ‘{

"settings": {

"index": {

"number_of_shards": 5,

"number_of_replicas": 1

  }

  }

}‘

CURL -XGET ‘http://192.168.1.10:9200/library/_settings‘

CURL -XGET ‘http://192.168.1.10:9200/library,library2/_settings‘

CURL -XGET ‘http://192.168.1.10:9200/_all/_settings‘

技術分享圖片

技術分享圖片

PUT /twitter/tweet/3
{
  "title":"Elasticsearch:the Defimitive Guide",
  "name" :{
    "first":"zhangchang",
    "last":"tong"
  },
  "publish_date":"2015-02-06",
  "price":"49.999"
}

GET /twitter/tweet/3?_source=title,source 取title

  • 更新
            • POST /twitter/tweet/3/_update
              {
                "doc": {
                  "title":"fly"
                }
              }

elasticsearch(5) curl 操作elasticsearch