younifyd
Menu

Index (POST /{index}/_doc/{id})

Index

POST/{index}/_doc/{id}

Use it in a workflow

  1. Add a step and choose the OpenSearch connector.
  2. Pick the Index (POST /{index}/_doc/{id}) action (under core).
  3. Fill in the fields below, then reference the result from later steps as {{indexPostIndexDocId.response.data}}.

Request

Path parameters

idstringrequired

The unique identifier for the document.

indexstringrequired

Name of the data stream or index to target.

Query parameters

if_primary_terminteger (int64)

Only perform the operation if the document has this primary term.

if_seq_nointeger (int64)

Only perform the operation if the document has this sequence number.

op_typeoneOf

Set to create to only index the document if it does not already exist (put if absent). If a document with the specified `_id` already exists, the indexing operation will fail. Same as using the `<index>/_create` endpoint. Valid values: `index`, `create`. If document id is specified, it defaults to `index`. Otherwise, it defaults to `create`.

pipelinestring

ID of the pipeline to use to preprocess incoming documents. If the index has a default ingest pipeline specified, then setting the value to `_none` disables the default ingest pipeline for this request. If a final pipeline is configured it will always run, regardless of the value of this parameter.

refreshoneOf

If `true`, OpenSearch refreshes the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` do nothing with refreshes. Valid values: `true`, `false`, `wait_for`.

require_aliasboolean

If `true`, the destination must be an index alias.

Default false

routingoneOf

A custom value used to route operations to a specific shard.

timeoutstring

Period the request waits for the following operations: automatic index creation, dynamic mapping updates, waiting for active shards.

versioninteger (int64)

Explicit version number for concurrency control. The specified version must match the current version of the document for the request to succeed.

version_typeoneOf

The specific version type: `external`, `external_gte`.

wait_for_active_shardsoneOf

The number of shard copies that must be active before proceeding with the operation. Set to all or any positive integer up to the total number of shards in the index (`number_of_replicas+1`).

prettyboolean

Whether to pretty-format the returned JSON response.

Default false

humanboolean

Whether to return human-readable values for statistics.

Default false

error_traceboolean

Whether to include the stack trace of returned errors.

Default false

sourcestring

The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.

filter_pathoneOf

A comma-separated list of filters used to filter the response. Use wildcards to match any field or part of a field's name. To exclude fields, use `-`.

Response

Returns 200 with an object. Read it in later steps with {{indexPostIndexDocId.response.data.<field>}}.

_typestring

The type of document or resource.

_idstring

The unique identifier for a resource.

_indexstring
_primary_terminteger (int64)

The primary term of the document.

resultoneOf
_seq_nointeger (int64)

The sequence number of the document.

_shardsobject
failedintegerrequired
successfulintegerrequired
totalintegerrequired
failuresarray<object>4 fields
skippedinteger
_versioninteger (int64)
forced_refreshboolean
json
{
  "_id": "string",
  "_index": "string",
  "_primary_term": 0,
  "result": null,
  "_seq_no": 0,
  "_shards": {
    "failed": 0,
    "successful": 0,
    "total": 0,
    "failures": [
      {
        "shard": 0,
        "reason": {
          "type": "string",
          "reason": "string",
          "stack_trace": "string",
          "caused_by": {},
          "root_cause": [
            {}
          ],
          "suppressed": [
            {}
          ],
          "header": {}
        },
        "index": "string",
        "node": "string"
      }
    ],
    "skipped": 0
  },
  "_version": 0,
  "_type": "string",
  "forced_refresh": false
}

Need more? See the OpenSearch guide for connection setup and behaviour shared by every action.