POST /blog/_doc/1{ "title": "Understanding Elasticsearch Core Concepts", "author": "John Doe", "content": "Elasticsearch is a distributed, RESTful search and analytics engine capable of solving a growing number of use cases...", "publish_date": "2023-08-23", "tags": ["Elasticsearch", "Search", "Tutorial"]}
3. 查询文档
我们可以通过简单的搜索请求来查询文章:
GET /blog/_search{ "query": { "match": { "content": "Elasticsearch" } }}
该查询会返回所有在content字段中包含“Elasticsearch”关键字的文章。
4. 更新文档
更新文档的内容(例如添加一个新标签):
POST /blog/_update/1{ "doc": { "tags": ["Elasticsearch", "Search", "Tutorial", "Guide"] }}