Easiest option, in terms of complexity, would probably be to use a bool query, where product x and y are matched by an id query with high boosts.
Best option is probably the function score query: http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html Create a filter for each product and replace the score with something arbitrarly high. You could get detailed by using a custom script, but it will not be as efficient. Cheers, Ivan On Mar 21, 2015 7:39 PM, "Zelfapp" <n...@usamm.com> wrote: > For specific queries I want to be able to manually set the sort of some > search results. Without going into the reason why, how do I implement this? > I'm not talking about boosting, I'm talking about manually setting the sort > position based on specific query. > > E.g. if users searches for "Green Military Shirts" I want to set product X > to position 1, product J to position 2. All other search results would > sorted as usual. > > -- > You received this message because you are subscribed to the Google Groups > "elasticsearch" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to elasticsearch+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/2757e0a1-ca5a-498e-89e2-02cf3dad9e0e%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/2757e0a1-ca5a-498e-89e2-02cf3dad9e0e%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elasticsearch" group. To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQCibunCj15nHP0vNm8gg0U7qukDL%3DUKrmahx-OR9KLhjQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.