Ingest Data into OCI Search with OpenSearch

This use case demonstrates how to use the OpenSearch Adapter to ingest JSON payload data into OCI Search with OpenSearch.

The use case described in this section (with the configured payload/relative URL/HTTP POST method) is equivalent to executing the following curl command against OCI Search with OpenSearch.
curl "Username:Password" -X POST "https://localhost:9200/test_index/_doc?pretty=true" -H "Content-Type: application/json" -d '
{
  "name": "product name",
  "price": 19.99,
   "description": "product description"
}'

The curl command ingests a new document whose payload is passed as a parameter in the test_index index and returns the new document id if successful.

  1. Configure an OpenSearch Adapter invoke connection. See Create an OpenSearch Adapter Connection.
  2. Create a schedule integration.
  3. Drag the OpenSearch Adapter invoke connection into the integration canvas and configure it as follows.
    1. On the Basic Info page, select Open Search Action.
    2. On the Summary page, view your selection.
  4. Open the mapper.
  5. Right-click the following target elements, and select Create target node.
  6. Define the following values in the Expression Builder.
    Target Element Expression Builder Value
    Input Payload

    The following payload is ingested into OCI Search with OpenSearch as escaped JSON string content:

    '{ "name": "product name", "price": 19.99, 
    "description": "product description" }'

    The payload can include any contents you want. However, you must ensure that the content to pass is correctly defined. Otherwise, an error occurs.

    Relative URI

    The URI to call relative to the base URL you specified on the Connections page.

    For this use case, this setting ingests a new document named doc into the test index:

    "/test_index/_doc"
    Method

    The HTTP method to call:

    "POST"
    Query Parameters Optional HTTP query parameters. For example:
    • Key = "pretty"
    • Value = "true"

    The completed mapper looks as follows:


    The Sources, Mapping canvas, and Target sections are shown. In the Target section, the elements described in the table above this image are shown.

    The end result of this mapping is as follows:
    • A new document containing the above JSON payload is ingested into the test_index index.
    • The corresponding document ID is returned with the _id attribute as part of the response from OCI Search with OpenSearch.
  7. Define a log action to capture the response payload returned by the invoke connection in the activity stream.

    The Sources section shows the elements tree. OpenSearchDemo is expanded to shown responsePayload. On the right the logger message shows responsePayload.

  8. Specify a business identifier and activate the integration.

    The completed integration looks as follows:


    The completed integration shows a schedule, map action, invoke action, and logger action.

  9. From the Actions Actions icon menu, select Run.
    The Configure and run page appears.
  10. In the Request type section, select Ad hoc request, then click Run.
  11. Once complete, expand the invoke connection in the activity stream.
  12. View the message sent to the OpenSearch Adapter invoke connection to begin this integration.

    The activity stream shows Invoke OpenSearchDemo expanded. the XML of the message received by this invoke is shown.

  13. View the wire message payload sent to OCI Search with OpenSearch.

    Invoke OpenSearchDemo is expanded in the activity stream. The Payload button of the Wire Message sent by Invoke OpenSearchDemo is selected. The payload is shown.

  14. View the wire message payload received back from OCI Search with OpenSearch.

    Invoke OpenSearchDemo is expanded to show the Payload button selected. The payload received from OpenSearch is shown.

  15. Expand the logger to view more details about the response. An _id value is provided for the new data indexed in OCI Search with OpenSearch.

    The Logger Logger1 output is shown. This logger shows the response message.