Type to search.

Perform document extraction inference on the service

Auth The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Extract the content of documents, such as PDFs or images of documents, into a textual format.

Required privileges

Cluster privileges monitor_inference

Path parameters

inference_id string required

The unique identifier for the inference endpoint.

Query parameters

timeout string · default: 120s

The amount of time to wait for the inference request to complete.

Request body

input union oneOf required

The documents to extract the content from. Either a content object or an array of content objects.

content object example:

Text
"input": {
  "content": {
    "type": "pdf",
    "format": "base64",
    "value": "data:application/pdf;base64,..."
  }
}

content object array example:

Text
"input": [
  {
    "content": {
      "type": "pdf",
      "format": "base64",
      "value": "data:application/pdf;base64,..."
    }
  },
  {
    "content": {
      "type": "image",
      "format": "url",
      "value": "https://example.com/scanned-page.png"
    }
  }
]
object or object[]
content object required

The document to extract the content from.

type enum required

The type of the document. Not all services and models support all types.

Values: image pdf html
format enum

The format of the document. If not specified, this defaults to base64 for pdf and image, and url for html. The html type supports url only. Not all services and models support all formats.

Values: base64 url
value string required

The value of the document. For the base64 format, this must be a base64-encoded data URI, that is, "data:content/type;base64,...". For the url format, this must be a URL that points to the document, that is, "https://example.com/document.pdf".

Response

application/json
document_extraction object[] required
content string required

The content extracted from the document.

format string required

The format of the extracted content, for example markdown.

metadata object

Additional information about the document, such as its title. The available fields depend on the service and model.