页首HTML代码

Y先生的小屋

导航

elasticsearch-索引

1、创建新索引

PUT:http://localhost:9200/twitter

{
     "settings" : {
        "number_of_shards" : 3,
        "number_of_replicas" : 2
    },
    "mappings" : {
        "type1" : {
            "properties" : {
                "field1" : 
                { 
                    "type" : "string", 
                    "index" : "not_analyzed" 
                }
            }
        }
    },
    "aliases" : {
        "alias_1" : {}
    }
}
View Code

2、删除索引

DELETE:http://localhost:9200/twitter

3、获取索引信息

GET:http://localhost:9200/twitter/

GET:http://localhost:9200/twitter/_settings,_mappings/

4、判断索引是否存在

官方示例:curl -XHEAD -i 'http://localhost:9200/twitter'

状态码404表示索引不存在,状态码200表示存在

posted on 2016-07-17 22:37  Y.Mr  阅读(134)  评论(0编辑  收藏  举报

页脚HTML代码