Skip to content

msearch_template fails on request #2127

@paul-e-jang

Description

@paul-e-jang

Describe the feature:

Elasticsearch version (bin/elasticsearch --version):
7.17.8

elasticsearch-py version (elasticsearch.__versionstr__):
7.17.0

Please make sure the major version matches the Elasticsearch server you are running.

b = [{ "index": "some-index*" },
     { "id": "template_id", "params": { "keyword": "key"}},
     { "index": "some-other-index*" },
     { "id": "template_id2", "params": { "keyword": "key"}}]

es.msearch_template(body=b)  // OR
es.msearch_template(search_templates=b) 

// result in the same error below:

---------------------------------------------------------------------------
BadRequestError                           Traceback (most recent call last)
<ipython-input-75-a87865ceb6d2> in <module>
      5 
      6 
----> 7 es.msearch_template(body=b)

\python\python38\lib\site-packages\elasticsearch\_sync\client\utils.py in wrapped(*args, **kwargs)
    402                         pass
    403 
--> 404             return api(*args, **kwargs)
    405 
    406         return wrapped  # type: ignore[return-value]

\python\python38\lib\site-packages\elasticsearch\_sync\client\__init__.py in msearch_template(self, search_templates, index, ccs_minimize_roundtrips, error_trace, filter_path, human, max_concurrent_searches, pretty, rest_total_hits_as_int, search_type, typed_keys)
   2646             "content-type": "application/x-ndjson",
   2647         }
-> 2648         return self.perform_request(  # type: ignore[return-value]
   2649             "POST", __path, params=__query, headers=__headers, body=__body
   2650         )

\python\python38\lib\site-packages\elasticsearch\_sync\client\_base.py in perform_request(self, method, path, params, headers, body)
    319                     pass
    320 
--> 321             raise HTTP_EXCEPTIONS.get(meta.status, ApiError)(
    322                 message=message, meta=meta, body=resp_body
    323             )

BadRequestError: BadRequestError(400, 'action_request_validation_exception', 'Validation Failed: 1: no requests added;')


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions