-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
Fix nested query issue #144
base: master
Are you sure you want to change the base?
Fix nested query issue #144
Conversation
I've added a test to illustrate what needs to be different between v1 and v2 syntax |
@danpaz I think I'd like to go for a v3 of bodybuilder soon, which would drop support for elasticsearch v1 syntax. That might also allow us to shorten and simplify some of the generated bools. I imagine this fix to be part of that bodybuilder v3. What are your thoughts on that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johannes-scharlach Agreed this is a breaking change and a solution like parsing the version from build
will work. Sounds like it could be tricky to implement cleanly, but I don't know if that warrants a major version bump to v3.
What do you think about implementing the backwards compatible bugfix here in v2, then coming up with a plan for v3 that includes things like dropping ES 1.x syntax, simplifying the generated bools, etc.?
}) | ||
}) | ||
|
||
test('queryBuilder | has_parent filter v1 syntax', (t) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a typo here v1 syntax
f98c005
to
55d6aef
Compare
So I've thought about the issue brought up in this MR again and thought about ways of solving it:
I'd say we start working on a first alpha version of 3.0 with this change, breaking compatability with v1. I also have some other ideas for 3.0 that we should start talking about, but I don't see us releasing this in a backwards compatible version right now. |
I think I follow, but do you mean it feels wrong to add compatibility for Elasticsearch v2 syntax? In the past I've been following the EOL dates to decide when it's fair to drop support for past versions. Looks like 2.x will be EOL in Feb 2018. I'm on board with what you're thinking, though. A breaking change seems inevitable and we should aim to implement this change as part of a major version bump. |
Sorry, I mean v1 syntax. We've reached EOL for elasticsearch 1.x, so I'm not very motivated to jump through hoops to fix issues that only occur when you're using an older version of elasticsearch. |
Ah, yes. I'm in favor of dropping 1.x syntax as well, that version of Elasticsearch has been EOL since Jan 2017. |
In that case
|
To be clear I think it makes sense to drop v1 compatibility as part of a major version bump to bodybuilder 3.0. We probably don't want this to land in bodybuilder 2.0 as it could break things for existing users. Is that what you were thinking as well? |
Yes, that's what I was thinking, too |
b986f98
to
915287d
Compare
Fixes #142.
The added test case describes the scenario quite well: nesting with
query
added aquery
node to bool where it should have added amust
. When I tried to fix it, it became clear that usingfilter
in the context of'nested'
or'has_parent'
has only worked with elasticsearch version 1.x.This MR represents a breaking change for people using elasticsearch v 1.x!
We could work around this by changing some of the inner workings of bodybuilder: We know the version of the query language once
build()
is executed, so if we defer the execution of allmakeFilter
andmakeQuery
calls to only be executed oncebuild
is called, we can pass along the ES version and will be fine.