I have yet to switch over to groovy, so I can't comment on where your current script is wrong (it looks good to me as well). However, you can use the "standard" function score, which are easier to understand and do not rely on scripting (technically better performance).
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_using_function_score Something like: "function_score": { "functions": [ { "boost_factor": "2", "filter": { "terms": { "_type": [ "my_type2" ] } } } } } -- Ivan On Wed, Sep 17, 2014 at 7:56 AM, Ramy <[email protected]> wrote: > i have solved it in that way... > > GET /my_index/my_type1,my_type2/_search > { > "query": { > "function_score": { > "query": { > "match": { > "value.autocomplete": "lorem ipsum" > } > }, > "functions": [ > { > "script_score": { > "lang": "groovy", > "script": "doc['_type'].value == 'my_type2' ? _score * 2 : > _score" > } > } > ] > } > } > } > > cheers > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/b56befbd-69a7-47b8-9918-29cdcaa6a062%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/b56befbd-69a7-47b8-9918-29cdcaa6a062%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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQBky5oo_PoEoKw%3D3J_ih_TrsFpq7E4APgFjjzFTu_V0CQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
