-
Notifications
You must be signed in to change notification settings - Fork 368
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
Filters defined in query are missing from request body #672
Comments
@pyromaniac |
This generates the query that you want: UsersIndex.filter(term: {"country": "US"}).filter(term: { "confirmed": true }) Passing |
@oricodes89 Sure. But according the documentation, I should be able to chain filters and queries all together. |
@jiajiawang But you can chain filters and queries, just use the DSL provided by chewy. UsersIndex.query(term: {"country": "US"}).filter(term: { "confirmed": true })
=> {:query=>{:bool=>{:must=>{:term=>{:country=>"US"}}, :filter=>{:term=>{:confirmed=>true}}}}} It doesn't return what you expected on your original post:
But you can use two filter queries like I suggested if you want to render that particular query. |
@oricodes89 I have no doubt that chaining two filters can result in the request body I want. But that's not my question.
would result in the same request body. |
@jiajiawang I guess I'm missing something on the documentation, can you share an example on it? |
@oricodes89 I'm not sure what other examples you want me to share.
|
Mmm...I guess I never expected it because the gem does not give you any example combining those kinds of queries. |
For queries like
I'm expecting the request body would be
However, the real request body is
I tracked down the issue to this line of code https://github.com/toptal/chewy/blob/master/lib/chewy/search/parameters.rb#L157
Is it a bug?
The text was updated successfully, but these errors were encountered: