Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to do an AND of multiple term filters in a query #66

Closed
pushrax opened this issue Mar 23, 2014 · 3 comments
Closed

No way to do an AND of multiple term filters in a query #66

pushrax opened this issue Mar 23, 2014 · 3 comments

Comments

@pushrax
Copy link

pushrax commented Mar 23, 2014

To term filter multiple fields at the root level, you can do

Search("...").Filter(
    Filter().Terms(...),
    Filter().Terms(...),
)

There doesn't seem to be any way to do this on a filtered query though, which is probably the more useful version anyway. I think QueryDsl should contain a FilterWrap rather than a FilterOp.

@mattbaird
Copy link
Owner

can you implement and provide a PR? Work is getting super busy for me.

@mikeyoon
Copy link
Contributor

mikeyoon commented Apr 9, 2015

If you like to live on the edge, you can try the code in my PR #177. In this fork you'd do the following:

Search("...").Filter(
    Filter().And(Filter().Terms(...)).And(Filter().Terms(...)),
)

Which would construct an And filter and use that in the search query. Would be great to get feedback. Unfortunately, I changed the Filter API so some of your existing stuff will probably break depending on what you used.

@mikeyoon
Copy link
Contributor

mikeyoon commented Dec 9, 2015

#238 is merged now, so this should be available.

@pushrax pushrax closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants