How to exclude a specific field in multi get query globally for all docs?

Hi, I'm trying to exclude a specific field in a multi-get query, but not by specifying _source ou _source_excludes in each doc but globally for all docs, how is it possible? Thank u in advance for your help :wink:

I think you can use _source_excludes query parameter instead of _source_exclude in request body. The former is a query parameter and applied to all docs in the query. See Multi get (mget) API | Elasticsearch Guide [7.15] | Elastic.

Hi Tomo_M, thank you for your reply. It works perfectly. I didn't think it was possible to combine query parameters and body parameters. If it can help other people, here's my sample query :

GET /my_index/_mget?_source_excludes=my_excluded_field_name
"ids": ["my_first_id", "my_second_id","my_third_id"]
1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.