Overall goal: tag search requests with application-specific correlation data (e.g. event context) so that packetbeat can parse and index es activity by these correlation data.
Our application is written in C#, and we're using the LowLevel client, and we noticed that the SearchRequestParameters object has a "Stats()" call that allows you to add application-specific data to the request. See: https://github.com/elastic/elasticsearch-net/blob/bc48aa07a489923fa213dc22aec0ff625551b70d/src/Elasticsearch.Net/Domain/RequestParameters/RequestParameters.Generated.cs#L1905
We are looking to do this with the ScrollAsync call, which uses a ScrollRequestParameters, but I am unable to find a Stats() entry. The below does not compile.
client.LowLevel.ScrollAsync<DynamicResponse>(<body>, p => p.Stats("foobar"));
I have confirmed that a "curl" to scroll _search/scroll/?stats=foobarbaz... does indeed work.
As a reminder, the overall goal is just to get data into the request so that packet beat can get it. Perhaps we could do this if we could get access to the header (just add some header data and have packet beat parse that), but I could not see a way to get access to the header using the LowLevel client.
Any help to accomplish the overall goal of tagging searches and scrolls (including every subsequent scroll request) would be helpful.