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

上一篇:使用 WebView2 封装一个生成 PDF 的 WPF 控件


下一篇:JAVA异常