I am trying to create a method to process a certain query. I follow an example posted on the Nest repository (line 60), but still the MatchAll is not recognized by the compiler and if I try to build the solution, the error that shows is:
Operator '??' cannot be applied to operands of type IQueryContainer and lambda expression
This is my method so far:
public void ProcessQuery(IQueryContainer query = null)
{
   var searchResult = this._client.Search<T>(
                s => s
                    .Index(MyIndex)
                    .AllTypes()
                    .From(0)
                    .Take(10)
                    .Query(query ?? (q => q.MatchAll())) // Not valid
                    .SearchType(SearchType.Scan)
                    .Scroll("2m")
                );
}
				
                        
Thanks to the comment of @Mrinal Kamboj and the answer of @Wormbo, I found my own answer:
I changed the argument type to
QueryContainerand if the argument is null, a newQueryMatchAllquery is created, this works for me: