Function Score Query and Native scripts


(Eric T) #1

Hi,

The function score documentation doesn't mention any support for native
scripts, does it still work for the Function Score Query, if so is it the
same syntax?
I'm using the custom_filters_score query with a native script but the query
is deprecated in the latest ES version. I'm still using 0.90.3 but I plan
to upgrade to the latest version.

It says that the script_score function for function_score is cached. Does
this provide the same performance as the Native script? I'm wondering if
it's necessary to still use a native script or convert it to the
script_score function

thanks
Eric

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3ac58df6-742f-4bcb-8ac2-856adeeeeb15%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Smith-2) #2

Yes, function score query works with native scripts. We use it with them.

I'm not sure whether native scripts are automatically cached.

On Saturday, April 12, 2014 1:49:32 PM UTC-4, Eric T wrote:

Hi,

The function score documentation doesn't mention any support for native
scripts, does it still work for the Function Score Query, if so is it the
same syntax?
I'm using the custom_filters_score query with a native script but the
query is deprecated in the latest ES version. I'm still using 0.90.3 but I
plan to upgrade to the latest version.

It says that the script_score function for function_score is cached. Does
this provide the same performance as the Native script? I'm wondering if
it's necessary to still use a native script or convert it to the
script_score function

thanks
Eric

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/edddb638-0b4e-49b8-8925-257064dc0afe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(David Smith-2) #3

You can use a function score query with a native script in this manner.

{

"function_score" : {

"query" : {

  "match_all" : { }

},

"functions" : [ {

  "filter" : {

    "terms" : {

      "myfield" : [ "103", "104", "134", "180" ],

      "_cache" : true

    }

  },

  "script_score" : {

    "script" : "myscriptname",

    "lang" : "native",

    "params" : {

      "myparam1" : "something",

      "myparam2" : "somethingElse"

    }

  }

} ],

"score_mode" : "sum"

}

}

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cb47555a-dd96-4dde-bf20-e80f42f975cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4