-
-
Notifications
You must be signed in to change notification settings - Fork 128
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
Invalid nested bool query with more "query", but works with "filter" #142
Comments
I've had a go at this in #144, but the current solution would be a breaking change to people using If you need this change quickly, you can fork my branch and build it for yourself or help with making the change backwards-compatible :) (All tests would need to pass) |
I've also just stumbled into this problem too, unfortunately =[ |
I've already moved to https://github.com/sudo-suhas/elastic-builder |
You can always specify the raw query syntax if something isn't supported. That's not optimal, but works all the time. Example: bodybuilder()
.query("bool", {
must: [
{
term: {
field1: 1
}
},
{
term: {
field2: 2
}
}
],
should: [
{
term: {
field3: 3
}
}
]
})
.query("bool", {
must: [
{
term: {
field4: 10
}
},
{
term: {
field5: 20
}
}
],
should: [
{
term: {
field6: 30
}
}
]
})
.build(); This would produce the query @piotrkochan was aiming for. |
Of course I could but this make no sense. The point of use libraries like bodybuilder is to do not write raw queries. Still it is really good to build simple queries. |
Sure, it would be better if we could merge #144. If you're interested in contributing, I can help point you to the pieces of code that would need to be changed to make the tests pass. |
Example code:
Makes perfect, valid query:
Change filters to queries:
And built query is invalid:
The text was updated successfully, but these errors were encountered: