Elasticsearch 增加、删除索引

创建索引

创建索引index时映射mapping

put 请求发送 http://localhost:9200/blog1

参数:

{
    "mappings": {
        "article": {
            "properties": {
                    "id": {
                    "type": "long",
                    "store": true,
                    "index":"not_analyzed"
                    },
                    "title": {
                    "type": "text",
                    "store": true,
                    "index":"analyzed",
                    "analyzer":"standard"
                    },
                    "content": {
                    "type": "text",
                    "store": true,
                    "index":"analyzed",
                    "analyzer":"standard"
                    }
            }
        }
    }
}

创建索引index后映射mapping

先使用 put 请求发送 http://localhost:9200/blog2

然后使用 post 请求发送http://localhost:9200/blog2/hello/_mapping

删除索引

使用DELET请求发送 http://localhost:9200/blog1

原文地址:https://www.cnblogs.com/shangwei/p/14297054.html