Skip to content

Examples#

Index > ElasticsearchService > Examples

Auto-generated documentation for ElasticsearchService type annotations stubs module types-boto3-es.

Client#

Implicit type annotations#

Can be used with types-boto3[es] package installed.

Write your ElasticsearchService code as usual, type checking and code completion should work out of the box.

# ElasticsearchServiceClient usage example

from boto3.session import Session


session = Session()

client = session.client("es")  # (1)
result = client.accept_inbound_cross_cluster_search_connection()  # (2)
  1. client: ElasticsearchServiceClient
  2. result: AcceptInboundCrossClusterSearchConnectionResponseTypeDef
# DescribeReservedElasticsearchInstanceOfferingsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("es")  # (1)

paginator = client.get_paginator("describe_reserved_elasticsearch_instance_offerings")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ElasticsearchServiceClient
  2. paginator: DescribeReservedElasticsearchInstanceOfferingsPaginator
  3. item: DescribeReservedElasticsearchInstanceOfferingsResponseTypeDef

Explicit type annotations#

With types-boto3-lite[es] or a standalone types_boto3_es package, you have to explicitly specify client: ElasticsearchServiceClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# ElasticsearchServiceClient usage example with type annotations

from boto3.session import Session

from types_boto3_es.client import ElasticsearchServiceClient
from types_boto3_es.type_defs import AcceptInboundCrossClusterSearchConnectionResponseTypeDef
from types_boto3_es.type_defs import AcceptInboundCrossClusterSearchConnectionRequestRequestTypeDef


session = Session()

client: ElasticsearchServiceClient = session.client("es")

kwargs: AcceptInboundCrossClusterSearchConnectionRequestRequestTypeDef = {...}
result: AcceptInboundCrossClusterSearchConnectionResponseTypeDef = client.accept_inbound_cross_cluster_search_connection(**kwargs)
# DescribeReservedElasticsearchInstanceOfferingsPaginator usage example with type annotations

from boto3.session import Session

from types_boto3_es.client import ElasticsearchServiceClient
from types_boto3_es.paginator import DescribeReservedElasticsearchInstanceOfferingsPaginator
from types_boto3_es.type_defs import DescribeReservedElasticsearchInstanceOfferingsResponseTypeDef


session = Session()
client: ElasticsearchServiceClient = session.client("es")

paginator: DescribeReservedElasticsearchInstanceOfferingsPaginator = client.get_paginator("describe_reserved_elasticsearch_instance_offerings")
for item in paginator.paginate(...):
    item: DescribeReservedElasticsearchInstanceOfferingsResponseTypeDef
    print(item)