Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate away from legacy generator, add basic request / response body types #1681

Merged
merged 3 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,10 @@ you don't have Elasticsearch running locally the integration tests will be skipp
All the API methods (any method in `elasticsearch.client` classes decorated
with `@query_params`) are actually auto-generated from the
[rest-api-spec](https://github.com/elastic/elasticsearch/tree/master/rest-api-spec/src/main/resources/rest-api-spec/api)
found in the `Elasticsearch` repository. Any changes to those methods should be
done either by submitting a PR to Elasticsearch itself (in case of adding or
modifying any of the API methods) or to the [Generate
Script](https://github.com/elastic/elasticsearch-py/blob/master/utils/generate_api.py).

To run the code generation make sure you have pre-requisites installed:

* by running `python -m pip install -e '.[develop]'`
* having the [elasticsearch](https://github.com/elastic/elasticsearch) repo
cloned on the same level as `elasticsearch-py` and switched to appropriate
version

Then you should be able to run the code generation by invoking:

```
$ python utils/generate-api.py 8.0.0-SNAPSHOT
```
found in the `Elasticsearch` or the [Elasticsearch specification](https://github.com/elastic/elasticsearch-specification)
repositories. Any changes to those methods should be done either by submitting a PR to one of these repositories
instead of directly to the Python client otherwise your change will be overwritten the
next time the APIs are generated.

## Contributing Code Changes

Expand Down
25 changes: 11 additions & 14 deletions elasticsearch/_async/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
from .transform import TransformClient
from .utils import SKIP_IN_PATH, _bulk_body, _make_path, _normalize_hosts, query_params
from .watcher import WatcherClient

# xpack APIs
from .xpack import XPackClient

logger = logging.getLogger("elasticsearch")
Expand Down Expand Up @@ -210,17 +208,9 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be
self.async_search = AsyncSearchClient(self)
self.autoscaling = AutoscalingClient(self)
self.cat = CatClient(self)
self.ccr = CcrClient(self)
self.cluster = ClusterClient(self)
self.dangling_indices = DanglingIndicesClient(self)
self.indices = IndicesClient(self)
self.ingest = IngestClient(self)
self.nodes = NodesClient(self)
self.remote = RemoteClient(self)
self.snapshot = SnapshotClient(self)
self.tasks = TasksClient(self)

self.xpack = XPackClient(self)
self.ccr = CcrClient(self)
self.data_frame = Data_FrameClient(self)
self.deprecation = DeprecationClient(self)
self.enrich = EnrichClient(self)
Expand All @@ -229,21 +219,28 @@ class as kwargs, or a string in the format of ``host[:port]`` which will be
self.fleet = FleetClient(self)
self.graph = GraphClient(self)
self.ilm = IlmClient(self)
self.indices = IndicesClient(self)
self.ingest = IngestClient(self)
self.license = LicenseClient(self)
self.logstash = LogstashClient(self)
self.migration = MigrationClient(self)
self.ml = MlClient(self)
self.monitoring = MonitoringClient(self)
self.nodes = NodesClient(self)
self.remote = RemoteClient(self)
self.rollup = RollupClient(self)
self.searchable_snapshots = SearchableSnapshotsClient(self)
self.security = SecurityClient(self)
self.slm = SlmClient(self)
self.shutdown = ShutdownClient(self)
self.slm = SlmClient(self)
self.snapshot = SnapshotClient(self)
self.sql = SqlClient(self)
self.ssl = SslClient(self)
self.tasks = TasksClient(self)
self.text_structure = TextStructureClient(self)
self.transform = TransformClient(self)
self.watcher = WatcherClient(self)
self.xpack = XPackClient(self)

def __repr__(self):
try:
Expand Down Expand Up @@ -1328,7 +1325,7 @@ async def put_script(self, id, body, context=None, params=None, headers=None):

:arg id: Script ID
:arg body: The document
:arg context: Context name to compile script against
:arg context: Script context
:arg master_timeout: Specify timeout for connection to master
:arg timeout: Explicit operation timeout
"""
Expand Down Expand Up @@ -1504,7 +1501,7 @@ async def scroll(self, body=None, scroll_id=None, params=None, headers=None):

:arg body: The scroll ID if not passed by URL or query
parameter.
:arg scroll_id: The scroll ID for scrolled search
:arg scroll_id: The scroll ID
:arg rest_total_hits_as_int: Indicates whether hits.total should
be rendered as an integer or an object in the rest search response
:arg scroll: Specify how long a consistent view of the index
Expand Down
Loading