Elasticsearch基本操作

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删除文档

原文地址:https://www.cnblogs.com/mjhblog/p/13934970.html