elasticsearch(5) curl 操作elasticsearch

创建索引之前可以对索引做初始化操作, 比如指定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"
                }
              }

 

posted @ 2018-01-31 18:08  一只宅男的自我修养  阅读(357)  评论(0编辑  收藏  举报