1. 程式人生 > 實用技巧 >Elasticsearch 增加、刪除索引

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