Query always overwrites
See original GitHub issueNEST/Elasticsearch.Net version: 2.3.1
Elasticsearch version: 2.3.2
Description of the problem including expected versus actual behavior:
If you are building a SearchDescriptor
and call .Query([query lambda])
on it, it overwrites the current query. This is inconsistent with the behaviour experiences when building a MultiSearchDescriptor
where .Search([name], [search lambda])
adds another search.
I know it’s not completely the same, but often you just want to add to a query. Personally I expected the argument of the lambda method in .Query([query lambda])
to be the current query, and not a completely new one every time.
(I also expected that every call to a method on some descriptor to be side effect free, but I got smarter and now see the value of the current approach, despite the lack of documentation)
For now I use an extension method to build my default query, and let this extension method take an optional argument of an additional query. It would be nice if the query method could take an additional boolean argument to tell it whether to merge this query or overwrite.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
@gmarz I agree completely, as my comment from 20 may also indicates 😃
@beruic that’s the correct way to go about it, using the bool operators.
I think
.Query()
being additive, or merging with the existing query would not be intuitive at all.Closing this, but feel free to re-open if you still think otherwise.