In NEST how to make the match query conditional?

How to make the match conditionally added/removed in c# .NET NEST?

var response = client.Search<Tweet>(s => s
    .Index("mytweetindex") //or specify index via settings.DefaultIndex("mytweetindex");
    .From(0)
    .Size(10)
    .Query(q => q
        .Term(t => t.User, "kimchy") || q
        .Match(mq => mq.Field(f => f.User).Query("nest"))
        .Match(mq => mq.Field(f => f.UserLocation).Query("NY")) //if UserLocation was supplied only than add this .Match Line.
    )
);

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