awswrangler.opensearch.create_index

awswrangler.opensearch.create_index(client: opensearchpy.client.OpenSearch, index: str, doc_type: Optional[str] = None, settings: Optional[Dict[str, Any]] = None, mappings: Optional[Dict[str, Any]] = None) Dict[str, Any]

Create an index.

Parameters
Returns

OpenSearch rest api response https://opensearch.org/docs/opensearch/rest-api/create-index/#response.

Return type

Dict[str, Any]

Examples

Creating an index.

>>> import awswrangler as wr
>>> client = wr.opensearch.connect(host='DOMAIN-ENDPOINT')
>>> response = wr.opensearch.create_index(
...     client=client,
...     index="sample-index1",
...     mappings={
...        "properties": {
...          "age":  { "type" : "integer" }
...        }
...     },
...     settings={
...         "index": {
...             "number_of_shards": 2,
...             "number_of_replicas": 1
...          }
...     }
... )