Skip to main content
If you’re new to Unstructured, read this note first.Before you can create a destination connector, you must first sign in to your Unstructured account:After you sign in, the Unstructured user interface (UI) appears, which you use to get your Unstructured API key.
  1. After you sign in to your Unstructured Let’s Go, Pay-As-You-Go, or Business account, click API Keys on the sidebar.
    For a Business account, before you click API Keys, make sure you have selected the organizational workspace you want to create an API key for. Each API key works with one and only one organizational workspace. Learn more.
  2. Click Generate API Key.
  3. Follow the on-screen instructions to finish generating the key.
  4. Click the Copy icon next to your new key to add the key to your system’s clipboard. If you lose this key, simply return and click the Copy icon again.
After you create the destination connector, add it along with a source connector to a workflow. Then run the worklow as a job. To learn how, try out the hands-on Workflow Endpoint quickstart, go directly to the quickstart notebook, or watch the two 4-minute video tutorials for the Unstructured Python SDK.You can also create destination connectors with the Unstructured user interface (UI). Learn how.If you need help, email Unstructured Support at support@unstructured.io.You are now ready to start creating a destination connector! Keep reading to learn how.
Send processed data from Unstructured to OpenSearch. The requirements are as follows.
  • For the Unstructured UI or the Unstructured API, local OpenSearch instances are not supported.
  • For Unstructured Ingest, local and non-local OpenSearch instances are supported. For example, to set up an AWS OpenSearch Service instance, complete steps similar to the following:
    1. Sign in to your AWS account, and then open your AWS Management Console.
    2. Open your Amazon OpenSearch Service console.
    3. On the sidebar, expand Managed clusters, and then click Dashboard.
    4. Click Create domain.
    5. In the Name tile, for Domain name, enter some unique domain name for your new OpenSearch instance.
    6. In the Domain creation method tile, select a method for creating the domain. For faster setup with sensible default settings, this example uses the Easy create method. Learn more about the Standard create method.
    7. In the Engine options tile, for Version, AWS recommends that you select the latest version.
    8. In the Network tile, for Network, select a network access method. For faster setup, this example uses the Public access method. Learn more about the VPC access method.
    9. For IP address type, select Dual-stack mode.
    10. In the Fine-grained access control tile, select Create master user.
    11. Specify some username and password for this master user by filling in the Master username, Master password, and Confirm master password fields. Make sure to save the master user’s password in a secure location.
    12. Click Create.
    13. After the domain is created, you must allow Unstructured to access the domain, as follows: a. If the new domain’s settings page is not already showing, open it as follows: in your Amazon Open Search Service console, on the sidebar, expand Managed clusters, and then click Domains. Then, in the list of available domains, click the name of the newly created domain.
      b. On the Security configuration tab, click Edit.
      c. In the Access policy tile, for Domain access policy, select Only use fine-grained access control.
      d. Click Clear policy.
      e. Click Save changes.
    The following video shows how to set up a local OpenSearch instance.
  • The instance’s host identifier (and port number, if you’re using a local OpenSearch instance), as follows:
    • For an AWS OpenSearch Service instance, do the following:
      1. Sign in to your AWS account, and then open your AWS Management Console.
      2. Open your Amazon OpenSearch Service console.
      3. On the sidebar, expand Managed clusters, and then click Dashboard.
      4. In the list of available domains, click the name of your domain.
      5. In the General information tile, copy the value of Domain endpoint v2 (dual stack).
    • For a local OpenSearch instance, see Communicate with OpenSearch.
  • The name of the search index on the instance. For the destination connector, if you need to create an index, you can use for example the following curl command. Replace the following placeholders:
    • Replace <host> with the instance’s host identifier.
    • If you’re using a local OpenSearch instance, replace <port> with the instance’s port number.
    • Replace <master-username> with the master user’s name, and replace <master-password> with the master user’s password.
    • Replace <index-name> with the name of the new search index on the instance.
    • Replace <index-schema> with the schema for the new search index on the instance. A schema is optional; see the explanation following this curl command for more information.
    curl --request PUT "<host>[:<port>]/<index-name>" \
    --user "<master-username>:<master-password>" \
    [--header "Content-Type: application/json" \
    --data '<index-schema>']
    
    For the destination connector, the index does not need to contain a schema beforehand. If Unstructured encounters an index without a schema, Unstructured will automatically create a compatible schema for you before inserting items into the index. Nonetheless, to reduce possible schema compatibility issues, Unstructured recommends that you create a schema that is compatible with Unstructured’s schema. Unstructured cannot provide a schema that is guaranteed to work in all circumstances. This is because these schemas will vary based on your source files’ types; how you want Unstructured to partition, chunk, and generate embeddings; any custom post-processing code that you run; and other factors. You can adapt the following index schema example for your own needs:
    {
        "settings": {
            "index": {
                "knn": true,
                "knn.algo_param.ef_search": 100
            }
        },
        "mappings": {
            "properties": {
                "record_id": {
                    "type": "text"
                },
                "element_id": {
                    "type": "keyword"
                },
                "text": {
                    "type": "text"
                },
                "embeddings": {
                    "type": "knn_vector",
                    "dimension": 384
                },
                "metadata": {
                    "type": "object",
                    "properties": {
                        "parent_id": {
                            "type": "text"
                        },
                        "page_number": {
                            "type": "integer"
                        },
                        "is_continuation": {
                           "type": "boolean"
                        },
                        "orig_elements": {
                           "type": "text"
                        },
                        "partitioner_type": {
                           "type": "text"
                        }
                    }
                }
            }
        }
    }
    
    See also:
  • For non-local OpenSearch instances, or if you’re using basic authentication to a local OpenSearch instance, the master user’s name and password.
  • For local OpenSearch instances, if you’re using certificates for authentication instead of basic authentication:
    • The path to the Certificate Authority (CA) bundle, if you use intermediate CAs with your root CA.
    • The path to the combined private key and certificate file, or
    • The paths to the separate private key and certificate file.
    To learn more, see Authentication backends, HTTP basic authentication, and Client certificate authentication.
To create an OpenSearch destination connector, see the following examples.
import os

from unstructured_client import UnstructuredClient
from unstructured_client.models.operations import CreateDestinationRequest
from unstructured_client.models.shared import CreateDestinationConnector

with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client:
    response = client.destinations.create_destination(
        request=CreateDestinationRequest(
            create_destination_connector=CreateDestinationConnector(
                name="<name>",
                type="opensearch",
                config={
                    "hosts": ["<host-name>:<port-number>"],
                    "index_name": "<index-name>",
                    "username": "<username>",
                    "password": "<password>",
                    "use_ssl": <True|False>
                }
            )
        )
    )

    print(response.destination_connector_information)
Replace the preceding placeholders as follows:
  • <name> (required) - A unique name for this connector.
  • <host-name>:<port-number> (required) - The OpenSearch instance’s host (and : followed by the port number, if you’re using a local OpenSearch instance).
  • <index-name> (required) - The name of the search index on the instance.
  • <username> - If you’re using basic authentication to the instance, the user’s name.
  • <password> - The password associated with the user’s name.
  • <field-name> (source connectors only) - Any specific fields to be accessed in the index.
  • <use-ssl> (required) - True if the OpenSearch instance requires an SSL connection; otherwise, false.