es学习-索引管理

 

1.创建索引

http://localhost:9200/suoyinguanli211/

 

参数:

{
   "settings":{
      "index":{
          "number_of_shards":3,分片数
          "number_of_replicas":2 副本数
     }
  }
}

 

 

结果如图

 

修改索引信息

 url:http://localhost:9200/suoyinguanli211/_settings/

 

参数:

{
"number_of_replicas":1
}

结果:

定义映射类型:

url:http://localhost:9200/suoyinguanli211-1/

参数:

{
	"settings": {
		"index": {
			"number_of_shards": 3,
			"number_of_replicas": 1
		},
		"mapping": {
			"secilog": {
				"properties": {
					"name": {
						"type": "string",
						"index": "not_analyzed"
					},
					"name2": {
						"type": "string",
						"index": "analyzed"
					}
				}
			}
		}
	}
}

  

结果:

 

删除索引:

url :delete http://localhost:9200/suoyinguanli211-1/

 

获取索引:

 

 也可以指定输出的内容:http://localhost:9200/suoyinguanli211/_mapping,_settings/

结果:

      

{
	"suoyinguanli211": {
		"mappings": {},
		"settings": {
			"index": {
				"creation_date": "1532779519842",
				"number_of_shards": "3",
				"number_of_replicas": "1",
				"uuid": "E4vDOCwSQVKY_wN17QXVaQ",
				"version": {
					"created": "2040099"
				}
			}
		}
	}
}

  

 

posted @ 2018-07-28 20:44  anxbb  阅读(200)  评论(0编辑  收藏  举报