Hi , I dont see why it should run into performance issue. In anyway you do it , the _score and score due to a field have to be computed/loaded. If you precompile your script by placing it in config directory , that should be good enough. Also feel free to write the same in Java code and attach that as script.
Thanks Vineeth On Mon, Dec 22, 2014 at 10:30 PM, Scott Decker <sc...@publishthis.com> wrote: > If you did the script score path, don't you run into performance issues? > I would think, running say thousands of queries like that would probably > not be performant. > unless I am missing something. > > On Sunday, December 21, 2014 8:01:06 PM UTC-8, vineeth mohan wrote: >> >> Hello , >> >> My advice would be to use the script function type. Inside it you can >> access _score which is the score given by the query and the value of the >> field. Mix them together in whatever logic you want. >> >> Thanks >> Vineeth >> >> On Thu, Dec 11, 2014 at 7:28 PM, hespoddi <ch...@publishthis.com> wrote: >> >>> Hi all, >>> >>> We'd like to combine the query score with our own custom trending score >>> for a given document. Currently, our query looks like: >>> >>> { >>> "query": { >>> "filtered": { >>> "filter": { >>> "and": [ >>> { >>> "range": { >>> "trendingScore": { >>> "gt": 0.0 >>> } >>> } >>> } >>> ] >>> }, >>> "query": { >>> "function_score": { >>> "functions": [ >>> { >>> "field_value_factor": { >>> "field": "trendingScore" >>> } >>> } >>> ], >>> "query": { >>> "bool": { >>> "minimum_should_match": 1, >>> "should": [ >>> { >>> "match_phrase": { >>> "title": { >>> "boost": 1.5, >>> "query": "<phrase>" >>> } >>> } >>> }, >>> { >>> "match_phrase": { >>> "content": { >>> "boost": 1.0, >>> "query": "<phrase>" >>> } >>> } >>> } >>> ] >>> } >>> } >>> } >>> } >>> } >>> } >>> } >>> >>> So, this query seems to do want we want: it multiples the query score >>> for document with our custom trending score (stored on the "trendingScore" >>> field). The problem is that the trending score, in many cases, overwhelms >>> the query score. Thus, documents with very low relevancy, but very high >>> trending, are at the top of our results. Ideally, we'd filter the query to >>> only return the top N percentage of documents that matched, but I don't >>> think that's possible. We've looked at the min_score parameter for queries >>> as well, but I don't know what a "good" value would be for this. >>> >>> Does anyone have any ideas on the best way to solve this problem? Thank >>> you ahead of time! >>> >>> -- >>> 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 elasticsearc...@googlegroups.com. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/elasticsearch/7bc5f7ed-4021-4044-bde0-a9e0f538e213% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/elasticsearch/7bc5f7ed-4021-4044-bde0-a9e0f538e213%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/72359b37-a130-4984-a329-f1dff43848d4%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/72359b37-a130-4984-a329-f1dff43848d4%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/CAGdPd5kMXpM6r%3DkS3Ef7qJB8nmqVZYcp6KGHoOWTJSRa17ivBA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.