其他分享
首页 > 其他分享> > es常用语句

es常用语句

作者:互联网

添加索引 put
PUT /myindex

{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 0
}
}

 

创建index_mappings索引 put
http://81.69.251.148:9200/index_mappings

{
"mappings":{
"properties":{
"realname":{
"type":"text",
"index":true
},
"username":{
"type":"keyword",
"index":false
}}}}

 

副本分片设置为0 put
http://81.69.251.148:9200/index_mappings/_settings
{
"number_of_replicas": 0
}

分词 get
http://81.69.251.148:9200/index_mappings/_analyze
{
"field":"realname",
"text":"my name is"
}

修改索引 put
http://81.69.251.148:9200/index_mappings/_mappings

{
"properties":{
"id":{
"type":"long"
},
"age":{
"type":"integer"
}
}
}

 

查询所有索引 get

http://81.69.251.148:9200/_cat/indices

http://81.69.251.148:9200/myindex

 

创建文档 post

http://81.69.251.148:9200/my_doc/_doc/1

{
    "id": 1001,
    "name":"mydoc",
    "desc":"mydoc非常牛逼",
    "create_time":"2021-11-11"
}

 删除文档 delete

http://81.69.251.148:9200/my_doc/_doc/2

局部修改文档 post

http://81.69.251.148:9200/my_doc/_doc/1/_update

{
    "doc":{
         "desc":"mydoc非常牛逼abc"
    }
}

全量修改文档 put

http://81.69.251.148:9200/my_doc/_doc/1

{
    "id": 1001,
    "name":"mydoc",
    "desc":"mydoc非常牛逼",
    "create_time":"2021-11-11"
}

查询所有文档数据 get

http://81.69.251.148:9200/my_doc/_doc/_search

标签:语句,index,常用,9200,251.148,doc,81.69,es,mappings
来源: https://www.cnblogs.com/yuanzipeng/p/15584115.html