zoukankan      html  css  js  c++  java
  • Elasticsearch 创建索引

    简单方式创建index

    curl -XPUT ‘http://localhost:9200/twitter/'

    在创建索引的时候指定分片和副本数量参数,参数格式采用JSON格式。

    curl -XPUT 'http://localhost:9200/twitter/' -d '{
      "settings":{
          "index":{
             "number_of_shards":3,
             "number_of_replicas":2
          }
      }
    }’

    或者简化为

    curl -XPUT 'http://localhost:9200/twitter' -d '{
      "settings":{
          "number_of_shards":3,
          "number_of_replicas":2
      }
    }'

    另外的一种create index方式

    curl -XPUT 'http://localhost:9200/twitter/tweet/1/_create' -d '{
      "user":"kimchy",
      "post_date":"2009-11-11T14:12:12",
      "message":"hello,world"
    }'

    以上代码如果不指定id(即1),系统会自动生成id。

    curl -XPUT http://localhost:9200/twitter/'
  • 相关阅读:
    3-1
    3-2
    习题二 8
    习题二 3
    习题二 5
    习题二 4
    习题二 6
    实验三-2未完成
    实验三
    心得
  • 原文地址:https://www.cnblogs.com/shangwei/p/14308565.html
Copyright © 2011-2022 走看看