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