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

Differences between Generated and Existing python client APIs #489

Closed
5 of 6 tasks
saimedhi opened this issue Sep 6, 2023 · 14 comments · Fixed by #551
Closed
5 of 6 tasks

Differences between Generated and Existing python client APIs #489

saimedhi opened this issue Sep 6, 2023 · 14 comments · Fixed by #551

Comments

@saimedhi
Copy link
Collaborator

saimedhi commented Sep 6, 2023

Take a look at issue #476 for more clarity.

Module existing client has generated client has
Async/init list_all_point_in_time get_all_pits
Async/init create_point_in_time create_pit
Async/security health_check health
Async/security update_audit_config update_audit_configuration
  • 2. APIs with Query_params differences
Module API existing client has generated client has status
Async/init search min_compatible_shard_node - min_compatible_shard_node should be removed
Async/init update_by_query version_type - version_type should be removed
Async/init create_point_in_time ignore_unavailable allow_partial_pit_creation ignore_unavailable, allow_partial_pit_creation both should be present
Async/cat cluster_manager cluster_manager cluster_manager_timeout, master_timeout cluster_manager_timeout, master_timeout both should be present and not cluster_manager
Sync/cat cluster_manager - master_timeout master_timeout should be present
Async/cat.pyi cluster_manager - master_timeout master_timeout should be present
Async/cat nodes include_unloaded_segments - include_unloaded_segments should be removed
Async/cat segments - cluster_manager_timeout, master_timeout cluster_manager_timeout, master_timeout both should be present
Async/cat plugins include_bootstrap - include_bootstrap should be removed
Async/cluster health - awareness_attribute, ensure_node_commissioned awareness_attribute should be present, ensure_node_commissioned should be removed
Async/cluster exists_component_template cluster_manager_timeout - cluster_manager_timeout should be present
Async/indices open cluster_manager_timeout - cluster_manager_timeout should be present
Async/indices delete cluster_manager_timeout - cluster_manager_timeout should be present
Async/indices exists_template cluster_manager_timeout - cluster_manager_timeout should be present
Async/indices stats types - types should be removed
Async/indices delete_data_stream expand_wildcards - expand_wildcards should be removed
Async/indices exists_index_template cluster_manager_timeout - cluster_manager_timeout should be present
Async/indices get_data_stream expand_wildcards - expand_wildcards should be removed
Async/ingest get_pipeline summary - summary should be removed
Async/nodes stats include_unloaded_segments - include_unloaded_segments should be removed
Async/nodes hot_threads doc_type - --
Async/snapshot get include_repository, index_details - include_repository, index_details should be removed
  • 3. APIs with path_params differences(mostly related to if params are required or optional, implies whether they should have =None)
Module API existing client has generated client has  status
Async/init create_point_in_time index=None index  need to be changed in python client index!=None
Async/indices put_mapping index=None index  index=None is correct
Async/indices create_data_stream - body=None body=None is should be removed. body param is not present.
Module API existing client has generated client has
Async/init create PUT POST
Async/init put_script PUT POST
Async/cluster put_component_template PUT POST
Async/indices refresh POST GET
Async/indices flush POST GET
Async/indices clone PUT POST
Async/indices put_mapping PUT POST
Async/indices put_alias PUT POST
Async/indices put_template PUT POST
Async/indices shrink PUT POST
Async/indices split PUT POST
Async/indices put_index_template PUT POST
Async/snapshot create PUT POST
Async/snapshot create_repository PUT POST
  • 5. APIs that are present in one and not present in other 
Module existing client has generated client has -
Async/init terms_enum - terms_enum should be removed
Async/cat transforms all_pit_segments, pit_segments, segment_replication transforms should be removed
Async/cluster - delete_decommission_awareness, delete_weighted_routing, get_decommission_awareness, get_weighted_routing, put_decommission_awareness, put_weighted_routing
Async/indices.py freeze, unfreeze, reload_search_analyzers, promote_data_stream, migrate_to_data_stream, disk_usage, field_usage_stats - freeze, unfreeze, field_usage_stats, reload_search_analyzers, disk_usage, migrate_to_data_stream should be removed. In sync Indices client, flush_synced is working and deprecated. Async Indices.flush_synced is not present.
Async/indices.pyi flush_synced -
Async/ingest geo_ip_stats - geo_ip_stats should be removed
Async/remote_store - all APIs
Async/snapshot repository_analyze - repository_analyze should be removed
  1. Async/init delete_point_in_time

    existing:

@query_params()
async def delete_point_in_time(self, body=None, all=False, params=None, headers=None):
    """
    Delete a point in time
    :arg body: a point-in-time id to delete
    :arg all: set it to `True` to delete all alive point in time.
    """
    path = (
        _make_path("_search", "point_in_time", "_all")
        if all
        else _make_path("_search", "point_in_time")
    )
    return await self.transport.perform_request(
        "DELETE", path, params=params, headers=headers, body=body
    )

generated:

@query_params()
async def delete_all_pits(self, params=None, headers=None):
    """
    Deletes all active point in time searches.
    """
    return await self.transport.perform_request(
        "DELETE", "/_search/point_in_time/_all", params=params, headers=headers
    )
    
    
@query_params()
async def delete_pit(self, body=None, params=None, headers=None):
    """
    Deletes one or more point in time searches based on the IDs passed.

    :arg body:
    """
    return await self.transport.perform_request(
        "DELETE",
        "/_search/point_in_time",
        params=params,
        headers=headers,
        body=body,
    )
  1. Async/nodes hot_threads path difference

    existing:

self.transport.perform_request(
            "GET",
            _make_path("_nodes", node_id, "hot_threads"),
            params=params,
            headers=headers,
        )

generated:

self.transport.perform_request(
            "GET",
            _make_path("_cluster", "nodes", node_id, "hot_threads"),
            params=params,
            headers=headers,
        )

Tasks and dangling_indices APIs have no differences b/w existing and generated modules

@github-actions github-actions bot added the untriaged Need triage label Sep 6, 2023
@saimedhi
Copy link
Collaborator Author

saimedhi commented Sep 6, 2023

Related to #477

@saimedhi saimedhi removed the untriaged Need triage label Sep 7, 2023
@saimedhi
Copy link
Collaborator Author

search_params = {
    "min_compatible_shard_node": 5
}


# search for all documents in the 'movies' index
response = client.search(index='movies', params=search_params)

# extract the count of hits from the response
hits_count = response['hits']['total']['value']

# print the count of hits
print("Total Hits: ", hits_count)

RequestError: RequestError(400, 'illegal_argument_exception', 'request [/movies/_search] contains unrecognized parameter: [min_compatible_shard_node]')

@saimedhi
Copy link
Collaborator Author

saimedhi commented Sep 12, 2023

update_by_query_params = {
    "version_type": 1
}


# search for all documents in the 'movies' index
response = client.update_by_query(index='movies', params=update_by_query_params)

# print the response
print("Response: ", response)

RequestError: RequestError(400, 'illegal_argument_exception', 'request [/movies/_update_by_query] contains unrecognized parameter: [version_type]')

@saimedhi
Copy link
Collaborator Author

create_point_in_time_params = {
    "ignore_unavailable": "true",
    "keep_alive": "1m"
}

# create a point-in-time snapshot for the 'movies' index
response = client.create_point_in_time(index='movies', params=create_point_in_time_params)
 
# print the response
print("Response: ", response)

Response: {'pit_id': '88j_QAEGbW92aWVzFnFhaEJ1TVNVU2o2TmI2OW9XOTBRV3cAFjk5NWJ4MFdaUjJPcjRJNUMwTkhBVFEAAAAAAAAAABsWZzNfS0lrcEpTRnFKalJYN2xBX0dhQQEWcWFoQnVNU1VTajZOYjY5b1c5MFFXdwAA', '_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0}, 'creation_time': 1694550942842}

@saimedhi
Copy link
Collaborator Author

create_point_in_time_params = {
    "allow_partial_pit_creation": "true",
    "keep_alive": "1m"
}

# create a point-in-time snapshot for the 'movies' index
response = client.create_point_in_time(index='movies', params=create_point_in_time_params)
 
# print the response
print("Response: ", response)

Response: {'pit_id': '88j_QAEGbW92aWVzFnFhaEJ1TVNVU2o2TmI2OW9XOTBRV3cAFjk5NWJ4MFdaUjJPcjRJNUMwTkhBVFEAAAAAAAAAAB8WZzNfS0lrcEpTRnFKalJYN2xBX0dhQQEWcWFoQnVNU1VTajZOYjY5b1c5MFFXdwAA', '_shards': {'total': 1, 'successful': 1, 'skipped': 0, 'failed': 0}, 'creation_time': 1694552239653}

@saimedhi
Copy link
Collaborator Author

get https://localhost:9200/_cat/cluster_manager?cluster_manager='60'
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_cat/cluster_manager] contains unrecognized parameter: [cluster_manager] -> did you mean [cluster_manager_timeout]?"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_cat/cluster_manager] contains unrecognized parameter: [cluster_manager] -> did you mean [cluster_manager_timeout]?"
},
"status": 400
}

@saimedhi
Copy link
Collaborator Author

saimedhi commented Sep 12, 2023

get https://localhost:9200/_cat/cluster_manager?master_timeout=60ms
success

@saimedhi
Copy link
Collaborator Author

get https://localhost:9200/_cat/nodes?include_unloaded_segments=true
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_cat/nodes] contains unrecognized parameter: [include_unloaded_segments]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_cat/nodes] contains unrecognized parameter: [include_unloaded_segments]"
},
"status": 400
}

@saimedhi
Copy link
Collaborator Author

saimedhi commented Sep 12, 2023

get https://localhost:9200/_cat/segments?master_timeout=10ms

success

get https://localhost:9200/_cat/segments?cluster_manager_timeout=10ms

success

@saimedhi
Copy link
Collaborator Author

get https://localhost:9200/_cat/plugins?include_bootstrap=true
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_cat/plugins] contains unrecognized parameter: [include_bootstrap]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_cat/plugins] contains unrecognized parameter: [include_bootstrap]"
},
"status": 400
}

@saimedhi
Copy link
Collaborator Author

https://localhost:9200/_cluster/health?ensure_node_commissioned=true
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_cluster/health] contains unrecognized parameter: [ensure_node_commissioned] -> did you mean [ensure_node_weighed_in]?"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_cluster/health] contains unrecognized parameter: [ensure_node_commissioned] -> did you mean [ensure_node_weighed_in]?"
},
"status": 400
}

@saimedhi
Copy link
Collaborator Author

post https://localhost:9200/movies/_open?cluster_manager_timeout=100ms

{
"acknowledged": true,
"shards_acknowledged": true
}

@saimedhi
Copy link
Collaborator Author

DELETE https://localhost:9200/movies/?cluster_manager_timeout=100ms
{
"acknowledged": true
}

@saimedhi
Copy link
Collaborator Author

get https://localhost:9200/_stats/_all?include_unloaded_segments=true
success

delete https://localhost:9200/_data_stream/*?expand_wildcards=open
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_data_stream/] contains unrecognized parameter: [expand_wildcards]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_data_stream/
] contains unrecognized parameter: [expand_wildcards]"
},
"status": 400
}

get https://localhost:9200/_data_stream/*?expand_wildcards=open
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_data_stream/] contains unrecognized parameter: [expand_wildcards]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_data_stream/
] contains unrecognized parameter: [expand_wildcards]"
},
"status": 400
}

put https://localhost:9200/_ingest/pipeline/pipelineid123

{
  "description": "This pipeline processes student data",
  "processors": [
    {
      "set": {
        "description": "Sets the graduation year to 2023",
        "field": "grad_year",
        "value": 2023
      }
    },
    {
      "set": {
        "description": "Sets graduated to true",
        "field": "graduated",
        "value": true
      }
    },
    {
      "uppercase": {
        "field": "name"
      }
    }
  ]
}

{
"acknowledged": true
}

get https://localhost:9200/_ingest/pipeline/pipelineid123?summary=true
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_ingest/pipeline/pipelineid123] contains unrecognized parameter: [summary]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_ingest/pipeline/pipelineid123] contains unrecognized parameter: [summary]"
},
"status": 400
}

get https://localhost:9200/_nodes/stats?include_unloaded_segments=true
{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "request [/_nodes/stats] contains unrecognized parameter: [include_unloaded_segments]"
}
],
"type": "illegal_argument_exception",
"reason": "request [/_nodes/stats] contains unrecognized parameter: [include_unloaded_segments]"
},
"status": 400
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant