I am trying to execute a search on the Elasticsearch client in Go olivere/elastic, using the appropriate client library for Elasticsearch version 7.x. The expected behavior is to compile the code without errors and return a scrollable search result with the specified query, aggregation, size, track total hits, pretty, and sort options.
However, the actual behavior is producing an error message that suggests the methods Aggregation, Size, TrackTotalHits, Pretty, Sort, and Do are not recognized. This error message may indicate an issue with the syntax or reference of the Elasticsearch client methods.
Can anyone suggest steps to troubleshoot this issue and help me resolve the error? Additionally, please find below the code I am currently working with:
searchResult, err := r.elasticClient. Scroll(). Index(r.index). Query(query). Aggregation("agg", agg). Size(limit). TrackTotalHits(true). Pretty(true). Sort("startTime", true). Do(context.Background())
Thank you for your assistance!
Errors on my IDE: