GET _search
{
“query”: {
“match_all”: {}
}
}
GET _all/_settings/
DELETE my_index
PUT /lib
{
“settings”: {
“number_of_shards”: “1”,
“number_of_replicas”: “0”
}
}
GET /lib/user/1?_source=age,name
PUT /lib/user/1
{
“name”:”小小狗子”,
“age” : 13
}
PUT /lib/user/1
{
“name”:”小小狗33子”,
“age” : 38
}
GET /lib/user/1
POST /lib/user/1/_update
{
“docs”: {
“name”: “ddd”
}
}
PUT twitter/_doc/1
{
“user” : “lance”,
“post_date” : “2019-11-15T14:12:12”,
“message” : “trying out Elasticsearch”
}
PUT twitter/_doc/1?version=3
{
“message” : “elasticsearch now has versioning support, double cool!”
}
GET twitter/_doc/
PUT twitter/_doc/3/_create
{
“user” : “3333”,
“post_date” : “2009-11-15T14:12:12”,
“message” : “trying out Elasticsearch”
}
POST twitter/_doc/
{
“user” : “4444”,
“post_date” : “4444-11-15T14:12:12”,
“message” : “trying out Elasticsearch”
}
POST twitter/_doc?routing=kimchy
{
“user” : “kimchy”,
“post_date” : “2009-11-15T14:12:12”,
“message” : “trying out Elasticsearch”
}
GET twitter/_doc/5
HEAD twitter/_doc/1
GET twitter/_doc/1?_source=false
GET twitter/_doc/3?_source_include=*user&_source_exclude=message
GET twitter/_doc/3?_source=*message,user
GET twitter/_doc/3/_source
GET twitter/_doc/3?routing=user
PUT twitter/_doc/5?routing=user1
{
“counter” : 1,
“tags” : [“white”]
}
GET twitter/_doc/5?routing=user1&stored_fields=tags,counter
GET twitter/_doc/5?routing=user1
PUT lance
{
“mappings”: {
“_doc”: {
“properties”: {
“counter”: {
“type”: “integer”,
“store”: false
},
“tags”: {
“type”: “keyword”,
“store”: true
}
}
}
}
}
PUT lance/_doc/1
{
“counter” : 1,
“tags” : [“red”]
}
GET lance/_doc/1?stored_fields=tags,counter
PUT lance/_doc/2?routing=user1
{
“counter” : 1,
“tags” : [“white”]
}
HEAD lance/_doc/2?routing=user1
GET lance/_doc/2?routing=user1&stored_fields=tags,counter
GET lance/_doc/2?routing=user1
GET lance/_doc/2
GET lance/_mapping/field/tags
GET lance/_doc/_mget
{
"ids":["1","2"]
}
本文欢迎转载,但是希望注明出处并给出原文链接。
如果你有任何疑问,欢迎在下方评论区留言,我会尽快答复。
如果你喜欢或者不喜欢这篇文章,欢迎你发邮件到 alonecong@126.com 告诉我你的想法,你的建议对我非常重要。
本文作者: lancecong
联系方式: alonecong@126.com
版权声明: 除特别声明外,所有文章均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!