Index API
创建索引
PUT my_index
PUT my_index
{
"settings": {},
"mappings": {}
}
PUT my_index/_doc/1
{
"name": "test name"
}
op_type: create or index
PUT my_index/_doc/1?op_type=index
{
"first_name": "John",
"last_name": "Smith"
}
version_type: internal or external or external_gte
internal: 当version == 当前文档的version才可以操纵成功
external: 当version > 当前文档的version才可以操纵成功
external_gte: 当version >= 当前文档的version才可以操纵成功
PUT my_index/_doc/1?version=11&version_type=internal
{
"first_name": "John",
"last_name": "Smith"
}
自动ID
POST twitter/_doc/
{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elasticsearch"
}
routing
POST twitter/_doc?routing=kimchy
{
"user" : "kimchy",
"post_date" : "2009-11-15T14:12:12",
"message" : "trying out Elasticsearch"
}
网友评论