Nested documents boolean query doubt/problem #749
Comments
Hi, for solving this "cross matching" issue, you need to use the special See:
Ping me back with more questions if you need. (Also, better use the |
You are awesome! After i did your links i did another mapping structure like this:
and a query construction like in your nested query test:
It all worked out. Another last question if i may, since i will be returning an array a set of Venue results something similar to this:
With this result i only want to retrieve the items of weekdays that match my boolean query (type = 0) is that possible? Since it's a nested document ideally i could do something like this:
Where the only weekdays items are there are the ones who match type = 0 Let me know if i didn't explain myself properly. Once again awesome tips and love your work! |
Hi, thanks, you're very welcome :) I know what you're after -- but Elasticsearch will return the whole document |
@miguelm It's on the Elasticsearch roadmap though to return matching nested documents, elastic/elasticsearch#3022 |
Nice catch, will follow up that issue elastic/elasticsearch#3022 For now i will do a The most difficult part is solved, do you want to keep this issue as it links to the elastic search issue or should i close it so it doesn't take up more space on your backlog? Once again thank you very much and hope i can repay it sometime in the future :) |
@miguelm I think we can close it here. Thanks! |
Hi,
Sorry if this is the wrong place to post this, but i have searched for a while in other issues and documentation and didn't find the answer to my problem.
I'm using mongoid and i have a base class Venue:
And my embedded document Weekday:
In the hours field of my Weekday embedded documents i have an array with data like this:
What i'm trying to accomplish here is obtaining Venue documents given a specific type of weekday and between a range of hours.
I.e. I want documents with weekdays.type = 1 and an hours between 11:00 and 12:00.
For that i'v built this query:
Unfortunately every-time all documents are returned, perhaps because there is weekdays with other type where the array has the 11:00 to 12:00 or even because since i'm trying to do a lexicographical comparison something might get borked (also used the \ to try to escape the : special character but also tested without it and same problem, even tried to change my model to have an integer 1100 instead of a string "11:00" but had the same problem).
So my question is, in this scenario what would be the best way to accomplish a query similar to this? and what am i doing wrong?
Thank you for your attention!
The text was updated successfully, but these errors were encountered: