未完结:
1.添加测试数据:
PUT /myindex/article/1
{
"post_date":"2020-12-08",
"title":"java",
"author_id":"119"
}
按id 查询:
GET /myindex/article/1
结果:
{
"_index" : "myindex",
"_type" : "article",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"post_date" : "2020-12-08",
"title" : "java",
"author_id" : "119"
}
}
2.按条件查询:
GET /myindex/article/1?_source=title
结果:
{
"_index" : "myindex",
"_type" : "article",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"title" : "java"
}
}
3.查询所有索引:
GET _all/_settings
结果:
{
".kibana_task_manager" : {
"settings" : {
"index" : {
"number_of_shards" : "1",
"auto_expand_replicas" : "0-1",
"provided_name" : ".kibana_task_manager",
"creation_date" : "1607401049582",
"number_of_replicas" : "0",
"uuid" : "viHsmmMMSEumCMZEP9i_ww",
"version" : {
"created" : "6080099"
}
}
}
},
".kibana_1" : {
"settings" : {
"index" : {
"number_of_shards" : "1",
"auto_expand_replicas" : "0-1",
"provided_name" : ".kibana_1",
"creation_date" : "1607401050268",
"number_of_replicas" : "0",
"uuid" : "2k6DXFIqSUCMVAAjFLh-Pg",
"version" : {
"created" : "6080099"
}
}
}
},
"myindex" : {
"settings" : {
"index" : {
"creation_date" : "1607418158668",
"number_of_shards" : "5",
"number_of_replicas" : "1",
"uuid" : "caSbPZoMQhukzdWyVDCL7A",
"version" : {
"created" : "6080099"
},
"provided_name" : "myindex"
}
}
}
}
GET /myindex/article/_mget
{
"ids":[1,2]
}
结果:
{
"docs" : [
{
"_index" : "myindex",
"_type" : "article",
"_id" : "1",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"post_date" : "2020-12-08",
"title" : "java",
"author_id" : "119"
}
},
{
"_index" : "myindex",
"_type" : "article",
"_id" : "2",
"_version" : 1,
"_seq_no" : 0,
"_primary_term" : 1,
"found" : true,
"_source" : {
"post_date" : "2020-11-08",
"title" : "ES",
"author_id" : "120"
}
}
]
}
测试语句:
GET _search
{
"query": {
"match_all": {}
}
}
PUT /myindex/article/1
{
"post_date":"2020-12-08",
"title":"java",
"author_id":"119"
}
PUT /myindex/article/2
{
"post_date":"2020-11-08",
"title":"ES",
"author_id":"120"
}
GET _all/_settings
GET /myindex/_settings
GET /myindex/article/_settings
GET /myindex/article/1
GET /myindex/article/2
GET /myindex/article/1?_source=title
GET /myindex/article/_mapping
DELETE /myindex
GET /myindex/article/_mget
{
"ids":[1,2]
}