> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS OpenSearch

## <Icon icon="https://mintcdn.com/xano-997cb9ee/aZQYcxhIvSDTNEim/images/icons/xs_temp.svg?fit=max&auto=format&n=aZQYcxhIvSDTNEim&q=85&s=6e05b86a660544b2d6040353bd8faac8" size={46} width="371" height="137" data-path="images/icons/xs_temp.svg" /> AWS OpenSearch: Request

```javascript theme={null}
cloud.aws.opensearch.request {
  auth_type = "IAM"
  key_id = ""
  access_key = ""
  region = ""
  method = "GET"
  url = ""
  query =
} as x1
```

| Parameter   | Purpose                         | Example                                           |
| ----------- | ------------------------------- | ------------------------------------------------- |
| auth\_type  | Authentication type for AWS     | `"IAM"`                                           |
| key\_id     | AWS access key ID               | `"AKIAXXXXXXXXXXXXXXXX"`                          |
| access\_key | AWS secret access key           | `"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`              |
| region      | AWS region for OpenSearch       | `"us-east-1"`, `"eu-west-1"`                      |
| method      | HTTP method for the request     | `"GET"`, `"POST"`, `"PUT"`, `"DELETE"`            |
| url         | OpenSearch endpoint URL         | `"https://search-domain.region.es.amazonaws.com"` |
| query       | Query to send to OpenSearch     | `{query: {match_all: {}}}`                        |
| as          | Alias to reference the response | `x1`, `search_results`                            |

<Accordion title="Example">
  ```javascript theme={null}
  cloud.aws.opensearch.request {
    auth_type = "IAM"
    key_id = $env.AWS_KEY_ID
    access_key = $env.AWS_SECRET_KEY
    region = "us-west-2"
    method = "GET"
    url = "https://search-mydomain.us-west-2.es.amazonaws.com/index/_search"
    query = {
      query: {
        match: {
          title: "search term"
        }
      }
    }
  } as search_response
  ```

  * Makes requests to AWS OpenSearch service
  * Supports IAM authentication
  * Can perform search and index operations
  * Returns OpenSearch response data
</Accordion>

## <Icon icon="https://mintcdn.com/xano-997cb9ee/aZQYcxhIvSDTNEim/images/icons/xs_temp.svg?fit=max&auto=format&n=aZQYcxhIvSDTNEim&q=85&s=6e05b86a660544b2d6040353bd8faac8" size={46} width="371" height="137" data-path="images/icons/xs_temp.svg" /> AWS OpenSearch: Document (CRUD)

```javascript theme={null}
cloud.aws.opensearch.document {
  auth_type = "IAM"
  key_id = ""
  access_key = ""
  region = ""
  method = "GET"
  index = ""
  doc_id = ""
  doc =
} as x2
```

| Parameter   | Purpose                         | Example                                |
| ----------- | ------------------------------- | -------------------------------------- |
| auth\_type  | Authentication type for AWS     | `"IAM"`                                |
| key\_id     | AWS access key ID               | `"AKIAXXXXXXXXXXXXXXXX"`               |
| access\_key | AWS secret access key           | `"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"`   |
| region      | AWS region for OpenSearch       | `"us-east-1"`, `"eu-west-1"`           |
| method      | CRUD operation type             | `"GET"`, `"POST"`, `"PUT"`, `"DELETE"` |
| index       | OpenSearch index name           | `"products"`, `"users"`                |
| doc\_id     | Document identifier             | `"123"`, `$item.id`                    |
| doc         | Document data for create/update | `{title: "New Product", price: 99.99}` |
| as          | Alias to reference the response | `x2`, `document_result`                |

<Accordion title="Example">
  ```javascript theme={null}
  cloud.aws.opensearch.document {
    auth_type = "IAM"
    key_id = $env.AWS_KEY_ID
    access_key = $env.AWS_SECRET_KEY
    region = "us-west-2"
    method = "POST"
    index = "products"
    doc_id = "prod_123"
    doc = {
      name: "Sample Product",
      description: "A great product",
      price: 29.99
    }
  } as document_response
  ```

  * Performs CRUD operations on OpenSearch documents
  * Supports create, read, update, delete operations
  * Works with specific document IDs
  * Returns operation result data
</Accordion>

## <Icon icon="https://mintcdn.com/xano-997cb9ee/aZQYcxhIvSDTNEim/images/icons/xs_temp.svg?fit=max&auto=format&n=aZQYcxhIvSDTNEim&q=85&s=6e05b86a660544b2d6040353bd8faac8" size={46} width="371" height="137" data-path="images/icons/xs_temp.svg" /> AWS OpenSearch: Search Query

```javascript theme={null}
cloud.aws.opensearch.query {
  auth_type = "IAM"
  key_id = ""
  access_key = ""
  region = ""
  index = ""
  payload =
  expression = []
  size = 0
  from = 0
  sort = []
  included_fields = []
  return_type = "search"
} as x3
```

| Parameter        | Purpose                        | Example                              |
| ---------------- | ------------------------------ | ------------------------------------ |
| auth\_type       | Authentication type for AWS    | `"IAM"`                              |
| key\_id          | AWS access key ID              | `"AKIAXXXXXXXXXXXXXXXX"`             |
| access\_key      | AWS secret access key          | `"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"` |
| region           | AWS region for OpenSearch      | `"us-east-1"`, `"eu-west-1"`         |
| index            | OpenSearch index to query      | `"products"`, `"users"`              |
| payload          | Query payload                  | `{match: {field: "value"}}`          |
| expression       | Array of query expressions     | `["term1", "term2"]`                 |
| size             | Number of results to return    | `10`, `50`, `100`                    |
| from             | Starting position for results  | `0`, `20`, `100`                     |
| sort             | Array of sort criteria         | `[{field: "asc"}]`                   |
| included\_fields | Fields to include in results   | `["name", "price", "description"]`   |
| return\_type     | Type of search response        | `"search"`, `"count"`                |
| as               | Alias to reference the results | `x3`, `search_results`               |

<Accordion title="Example">
  ```javascript theme={null}
  cloud.aws.opensearch.query {
    auth_type = "IAM"
    key_id = $env.AWS_KEY_ID
    access_key = $env.AWS_SECRET_KEY
    region = "us-west-2"
    index = "products"
    payload = {
      match: {
        name: "search term"
      }
    }
    expression = ["category:electronics"]
    size = 20
    from = 0
    sort = [{price: "desc"}]
    included_fields = ["name", "price", "category"]
    return_type = "search"
  } as product_results
  ```

  * Performs advanced queries on OpenSearch
  * Supports pagination with size and from
  * Can sort and filter results
  * Allows field selection
  * Supports different return types
</Accordion>
