Files
honeymoose f321dfedf5 同步完成!
**同步结果摘要**:

| 目录 | 同步前 | 同步后 | 官方 |
|------|--------|--------|------|
| aggregations | 40 | 65 | 64 |
| analyzers | 8 | 141 | 140 |
| api-reference | 97 | 186 | 174 |
| benchmark | 34 | 67 | 53 |
| clients | 17 | 18 | 18 |
| dashboards | 38 | 149 | 131 |
| data-prepper | 77 | 134 | 123 |
| im-plugin | 22 | 37 | 37 |
| ingest-pipelines | 27 | 52 | 51 |
| install-and-configure | 37 | 57 | 53 |
| ml-commons-plugin | 81 | 157 | 155 |
| observing-your-data | 39 | 73 | 66 |
| query-dsl | 40 | 77 | 75 |
| search-plugins | 80 | 139 | 95 |
| security-analytics | 22 | 47 | 46 |

**说明**:
- 本地文件数 > 官方:本地有一些官方已删除或重命名的文件
- 新增了约 **740 个英文文档文件**
- 已有文件保持不变(未覆盖)
2026-11-30 10:48:30 -05:00

2.1 KiB

layout, title, nav_order, redirect_from
layout title nav_order redirect_from
default Indexing data 3
/opensearch/index-data/

Indexing data

OpenSearch creates an index automatically the first time you add a document to a name that does not yet exist, and generates a document ID if you do not supply one. The following request creates the movies index and indexes one document into it:

POST movies/_doc
{ "title": "Spirited Away" }

{% include copy-curl.html %}

Specify the ID yourself when you expect to update or retrieve the document later. Sending the following request repeatedly leaves a single document in the index and increments its _version field, whereas repeating the preceding request creates a new document each time:

PUT movies/_doc/1
{ "title": "Spirited Away" }

{% include copy-curl.html %}

A document ID must be 512 bytes or smaller.

Indexing multiple documents

To index many documents in one request, use the Bulk API. Each action is described by a metadata line followed by the document itself, and every line must end with a newline character (\n), including the last one:

POST _bulk
{ "index": { "_index": "movies", "_id": "2" } }
{ "title": "My Neighbor Totoro" }
{ "index": { "_index": "movies", "_id": "3" } }
{ "title": "Princess Mononoke" }

{% include copy-curl.html %}

Bulk requests give better throughput than individual requests for large numbers of documents. If one action in a bulk request fails, OpenSearch runs the remaining actions and reports the outcome of each one in the items array of the response, in the order in which you specified the actions.

  • Add and manage your data: A tutorial that creates an index, adds documents to it, and reads them back.
  • Ingest data: Other ways to send data to OpenSearch, such as OpenSearch Ingestion and pull-based ingestion.
  • Document APIs: Retrieving, updating, and deleting documents.