Which technique is preferable aggregations or has_child query ?
-
Lets say we have Parent Document for book with it's name ISBN and short summary (and some other stuff) and child documents for chapters. I can also save "parent doc" data for every chapter as doc_values (not_analysed string) and then aggregate results at query time. Why this way? I want to boost score for those books where multiply chapters match. In Elasticsearch which technique is preferable : 1) Using nested documents and query them with has_child - non cached 2) Just store field from parent doc in child doc and apply aggregation - this option is going to take more disk space, but can be cached, no look-up for parent documents is required. Update:My intuition is that aggregation should cause less random IO - since IO is slowest part - aggregations should be faster. Average number of child documents will be a few hundreds docs. Thanks
-
Answer:
Both solutions have different use so it's not easy to answer the question without knowing the use case.
PaweŠRóg at Quora Visit the source
Other answers
I've came up with the following - child documents are encoded very efficiently(in the same block as parent document) so there is no need to duplicate data.
Kostya Voznesenskiy
Related Q & A:
- How to convert sql query to Hibernate Criteria query?Best solution by Stack Overflow
- How to convert my SQL query to MS Access query?Best solution by Stack Overflow
- How to convert SQL query to LINQ query?Best solution by Stack Overflow
- Is using `int` more preferable than using `unsigned int`?Best solution by Stack Overflow
- Are low-calorie alternatives always preferable?Best solution by familyshare.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.