Examples
Index > ElasticsearchService > Examples
Auto-generated documentation for ElasticsearchService type annotations stubs module mypy-boto3-es.
Client
Implicit type annotations
Can be used with boto3-stubs[es]
package installed.
Write your ElasticsearchService
code as usual,
type checking and code completion should work out of the box.
Explicit type annotations
With boto3-stubs-lite[es]
or a standalone mypy_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.
Client usage example
from boto3.session import Session
from mypy_boto3_es.client import ElasticsearchServiceClient
from mypy_boto3_es.type_defs import AcceptInboundCrossClusterSearchConnectionResponseTypeDef
from mypy_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)
Paginator usage example
from boto3.session import Session
from mypy_boto3_es.client import ElasticsearchServiceClient
from mypy_boto3_es.paginator import DescribeReservedElasticsearchInstanceOfferingsPaginator
from mypy_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)