I have my own scoring function which is very important so I need to retrieve data in the correct order. No problem here but I now want to limit my results by number of members, to get only the ordered results but for only the first 10 members. Then make a from clause to make a load more button.
I'm not even sure it is possible... If you have any idea on how I can make something like this, please feel free !
I want to retrieve my hits ordered by my score, and stop as I reach for example 10 distinct member_ids. My limit would not be on the document count but on a specific field.
More difficult : I want to add a Load More button, so that I could retrieve the next hits and so on.
I'm not quite sure I can perform something like this with the field collapsing...
What is it that you want to retrieve for each hit? Just the member_ids? Or all documents that belong to each of the top 10 member_ids?
What would happen with a document of a member in the top 10 that scores lower than a document of member #11? Would it be returned when you click " Load More"?
Sorry for these questions, but I'm trying to understand what it is that you're trying to do
Then, I want to have sort of a "pagination" to be able to add a Load More button, which sould result in the next hits for the 3 next member_ids (in this case only the last result, but in reality, a lot more.
Hope I'm understandable ! English is not my native language
English is not my native language either, but I think we're doing just fine
I don't think Elasticsearch offers you something out of the box without you having to do some bookkeeping on the client side. I do think field collapsing on the member_id field can be helpful, but it's not the complete solution for your case.
You will have to use the from and size parameters to paginate and get to pages of exactly 10 unique member_ids per result page. Tracking the number of members returned and remembering where you are in the pagination set is something you need to do yourself in the client application.
No, you will have to keep paginating until you get to 10 unique member_ids. Field collapsing will just make it a bit easier to keep track of how many IDs are being returned.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.