{"id":3087,"library":"mypy-boto3-es","title":"mypy-boto3-es: AWS Elasticsearch Service Type Stubs","description":"mypy-boto3-es provides type annotations for the AWS ElasticsearchService (now OpenSearch Service) Boto3 client, ensuring type safety and improved IDE experience for Python developers. It is part of the `mypy-boto3` ecosystem, currently at version 1.42.81, which aligns with the `boto3` version it provides stubs for. The library is actively maintained with frequent releases, driven by the `mypy-boto3-builder` project.","status":"active","version":"1.42.81","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["type-hints","mypy","boto3","aws","elasticsearch","opensearch","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-es","lang":"bash","label":"Install service stubs"},{"cmd":"pip install boto3 mypy","lang":"bash","label":"Install core dependencies (required for use)"}],"dependencies":[{"reason":"Provides the underlying AWS SDK for Python; these stubs type-check its usage.","package":"boto3","optional":false},{"reason":"The static type checker that utilizes these stubs.","package":"mypy","optional":false}],"imports":[{"note":"Import for type-hinting the boto3 client.","symbol":"ElasticsearchClient","correct":"from mypy_boto3_es.client import ElasticsearchClient"},{"note":"Type definitions (e.g., for request/response payloads) are in `type_defs`.","wrong":"from mypy_boto3_es.client import DomainConfigTypeDef","symbol":"Service-specific TypeDefs","correct":"from mypy_boto3_es.type_defs import DomainConfigTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_es.client import ElasticsearchClient\n\n# Instantiate the boto3 client with type hinting\nes_client: ElasticsearchClient = boto3.client(\"es\")\n\ntry:\n    # Example usage: list domain names\n    response = es_client.list_domain_names()\n    for domain in response.get('DomainNames', []):\n        print(f\"Found domain: {domain['DomainName']}\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"This example demonstrates how to instantiate a `boto3` Elasticsearch client and apply `mypy-boto3-es` type hints for improved static analysis. Ensure `boto3` is installed alongside `mypy-boto3-es`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Python 3.8 support was removed from `mypy-boto3-builder` in version 8.12.0. This means `mypy-boto3-es` versions generated by this builder (typically `1.42.x` and later) require Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (corresponding mypy-boto3-es versions)"},{"fix":"Review your code for explicitly imported TypeDefs and adjust their names according to the new conventions. Consult the `type_defs.pyi` file for the correct names.","message":"Type definition (TypeDef) naming conventions changed in `mypy-boto3-builder` 8.9.0. Specifically, redundant 'Request' suffixes were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). While the specific `es` service might not have these exact TypeDefs, users relying on explicit `mypy-boto3` TypeDef names across services may need to update their code.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (corresponding mypy-boto3-es versions)"},{"fix":"Ensure both `pip install boto3` and `pip install mypy` are run in your environment.","message":"The `mypy-boto3-es` package provides *only* type stubs. You must install `boto3` separately for your code to actually run and interact with AWS services. Similarly, `mypy` is required to perform static type checking.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always keep `mypy-boto3-es` and `boto3` versions aligned. For example, if you are using `boto3==1.42.81`, install `mypy-boto3-es==1.42.81`.","message":"The version of `mypy-boto3-es` typically corresponds to the `boto3` version it provides stubs for. If you upgrade `boto3` but do not update `mypy-boto3-es` to a matching or compatible version, you may encounter incorrect or missing type hints.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}