`
gaojingsong
  • 浏览: 1154621 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

【elasticsearch建立索引操作的API】

阅读更多

一、elasticsearch建立索引操作的API,基于CURL

1)设置主备分片数量

curl -XPUT 'http://192.168.1.105:9200/twitter1' -d '{

  "settings":{

      "number_of_shards":3,

      "number_of_replicas":0

  }

}'



 

2)创建mapping文件

curl -XPUT 'http://192.168.1.105:9200/twitter1/people/_mapping' -d '{

    "people": {

        "properties": {

            "date": {

                "type": "long"

            },

            "name": {

                "type": "string",

                "index": "not_analyzed"

            },

            "status": {

                "type": "integer"

            },

            "type": {

                "type": "integer"

            }

        }

    }

}'



 结果验证:



 

二、基于Head插件形式

1)设置主备分片数量

{

  "settings": {

    "index": {

      "number_of_shards": "3",

      "number_of_replicas": "0"

    }

  }

}




2)创建mapping文件

{/q1/student/_mapping

  "properties": {

    "date": {

      "type": "long"

    },

    "name": {

      "index": "not_analyzed",

      "type": "string"

    },

    "type": {

      "type": "integer"

    },

    "status": {

      "type": "integer"

    }

  }

}



 三、实验结果验证

 



 

 

  • 大小: 73.9 KB
  • 大小: 26.5 KB
  • 大小: 33.3 KB
  • 大小: 42.6 KB
  • 大小: 46.7 KB
  • 大小: 70.5 KB
0
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics