I'm using NEST query to filter records from elastic.
The following query will filter records based on phrase and list of sourceIds. But I would like to exclude some documents from the result if their URL contains ideaArticles list.
var result = ElasticSearchClientConnection.Client.Search<T>(s => s
.Query(q => q.Match(p => p.Field(f => f.Body).Query(phrase))
&& q.Terms(p => p.Field(f => f.SourceId).Terms(sourceIds))
&& !q.Terms(p => p.Field(f => f.URL).Terms(ideaArticles))
).Take(take));
must_notclause should help :)