Elasticsearch基本操作


1.ES結構

1.1索引index

 

 1.2 類型type

 

 1.3文檔

 

 

 

 1.4屬性Field

 

 

 

 2.操作ES的RESTFUL語法

 

 

3.索引的操作

3.1創建索引

 

 

3.2查看索引的方式

 

 3.3刪除索引

 

 

 3.4 ES中Field可以指定的類型(可以去官網查看自己版本的對應文檔

 

 

 

 3.5創建索引並指定數據結構

注意:elastic版本在7.X之后type中novel默認改為_doc

 

 

 

 

PUT /book
{
  "settings":{
    "number_of_shards":5,
    "number_of_replicas":1
  },
  "mappings":{
    "novel":{
      "properties":{
        "name":{
          "type":"text",
          "analyzer":"ik_max_word",
          "index":true,
         "store":false
        },
        "author":{
          "type":"keyword"
        },
        "count":{
          "type":"long"
        },
        "on-sale":{
          "type":"date",
          "format":"yyyy-MM-dd HH:mm:ss ||yyyy-MM-dd||epoch_millis"
        },
        "descr":{
          "type":"text",
          "analyzer":"ik_max_word"
        }
    }
  }
  }
}

 

 3.6文檔的操作

3.6.1新建文檔

 3.6.1新建文檔

 

 

 

 

 

 

 

 3.6.3刪除文檔

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM