asynchronous-search icon indicating copy to clipboard operation
asynchronous-search copied to clipboard

Support for typed_keys in GET asynchronous search API

Open Bukhtawar opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. The typed_keys specify whether aggregation and suggester names should be prefixed by their respective types in the response. Current this is only supported on SUBMIT API. Meaning if the request takes longer, future GET requests do not have an ability to return typed_keys any longer

Bukhtawar avatar Sep 29 '21 15:09 Bukhtawar

If the typed_keys=True param is set in the Submit API request, we are setting it in the underlying search request which continues to run in the background.

Irrespective of SUBMIT or GET asynchronous search call, the underlying search request and its final response will honor the typed_keys value which was set in the initial call. I don't see how the GET request result is failing to see the expected result.

As it is responsible for building the correct search request, if there is a bug it would be in the submit API itself? Or are you saying the intermediate/partial results is not honoring typed_keys?

Plz elaborate on this bug. Has it been reproduced?

eirsep avatar Sep 29 '21 18:09 eirsep

I'm currently on 7.10. I have this issue.

Irrespective of SUBMIT or GET asynchronous search call, the underlying search request and its final response will honor the typed_keys value which was set in the initial call. I don't see how the GET request result is failing to see the expected result.

In the below request/response, typed_keys is not honored in GET async.

Example submit request:

POST clustername/_opendistro/_asynchronous_search/?wait_for_completion_timeout=15s&keep_on_completion=true&keep_alive=100s&typed_keys
{
  "query": {
    "match_all": {}
  },
  "aggregations": {
    "agg_field_1":{
            "terms":{
                "field":"$cs.agg_field_1$keyword",
                "size":10,
                "min_doc_count":1,
                "shard_min_doc_count":0,
                "show_term_doc_count_error":false,
                "order":[
                    {
                        "_count":"desc"
                    },
                    {
                        "_key":"asc"
                    }
                ]
            }
        }
  }
}

Response aggregations for submit:

"aggregations" : {
      "sterms#agg_field_1" : {
        "doc_count_error_upper_bound" : 0,
        "sum_other_doc_count" : 0,
        "buckets" : [
          {
            "key" : "3",
            "doc_count" : 11253290
          }
        ]
      }
    }

If I try to use Get async for the same id.

GET _opendistro/_asynchronous_search/FnVoVHdzWGo2UzJlduZoS2phSUxmbncINDM1Mzg5yDgUTnJST00zd0JQM8ZxUHJEZWprMEkDMjAz

Response aggregations this time

"aggregations" : {
      "agg_field_1" : {
        "doc_count_error_upper_bound" : 0,
        "sum_other_doc_count" : 0,
        "buckets" : [
          {
            "key" : "3",
            "doc_count" : 11253290
          }
        ]
      }
    }

The field "agg_field_1" is now no longer annotated with the internal type "sterm".

Get async does not accept typed_keys as a parameter. X-pack Elasticsearch supports typed_keys in GET async api. https://elasticsearch-py.readthedocs.io/en/7.9.1/xpack.html?highlight=typed_keys

aneesh297 avatar Sep 29 '21 20:09 aneesh297

@eirsep what is the state of this issue? Feature complete was declared on https://github.com/opensearch-project/asynchronous-search/issues/42

peternied avatar Nov 16 '21 17:11 peternied

This is being targeted for 1.3. Removing 1.2 tag on this issue.

eirsep avatar Nov 17 '21 18:11 eirsep

I am using OS 2.12 and the issue is still here. Any updates since 2021?

w4p avatar Apr 18 '24 12:04 w4p