> For the complete documentation index, see [llms.txt](https://awsnotes.dendron.so/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://awsnotes.dendron.so/analytics/amazon-opensearch-service/topics/sample-code.md).

# Sample code

{% hint style="info" %}
This page was generated from content adapted from the [AWS Developer Guide](https://github.com/awsdocs/amazon-opensearch-service-developer-guide.git)
{% endhint %}

## Signing HTTP requests

* **Important**\
  The latest versions of the Elasticsearch clients might include license or version checks that artificially break compatibility. For the correct client version to use, see [Elasticsearch client compatibility](https://github.com/kevinslin/aws-reference-notes/blob/main/services/amazon_open_search_service/samplecode.md#client-compatibility).
* **Tip**\
  This sample uses the default credential chain. Run `aws configure` using the AWS CLI to set your credentials.

## Using the AWS SDKs

* **Important**\
  For examples of how to interact with the OpenSearch APIs, such as `_index`, `_bulk`, `_search`, and `_snapshot`, see [Signing HTTP requests to Amazon OpenSearch Service](https://github.com/kevinslin/aws-reference-notes/blob/main/services/amazon_open_search_service/request-signing.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://awsnotes.dendron.so/analytics/amazon-opensearch-service/topics/sample-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
