分布式搜索引擎ElasticSearch-Postman调用RestAPI
Postman调用RestAPI
新建索引
例如我们要创建一个叫articleindex的索引 ,就以put方式提交
http://192.168.2.10:9200/articleindex/
输出:
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "articleindex"
}
新建文档
以post方式提交
http://192.168.2.10:9200/articleindex/article
body:
{
"title":"SpringBoot2.0",
"content":"发布啦"
}
返回结果:
{
"_index": "articleindex",
"_type": "article",
"_id": "Za2J_GoBvavWbChwC_Cp",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 1,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
说明:
1)_id是由系统自动生成的。 为了方便之后的演示,我们再次录入几条测试数据。
查询全部文档
查询某索引某类型的全部数据,以get方式请求
http://192.168.2.10:9200/articleindex/article/_search 返回结果如下: