Getting more than just a score out of a search script

We're making extensive use of custom scoring (implemented in Java). One of
the problems we've encountered is that we'd love to get not just the score,
but other data that result from the score function out of Elasticsearch.
For example, this could be a flag marking certain documents, or some sort
of custom score explanation, or even another "score" (if you need multiple
dimensions perhaps).

So far, I haven't found any way of doing this. Search scripts simply return
a float. There doesn't seem to be anything like a "search context" to
decorate the returned results, at least not in the way I need it.

Any other ideas?

Thanks

Klaus

--
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/13e8367f-a2e6-4d70-8d7e-3e153200281a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Klaus ,

For document flagging or similar feature , you can use script filter with
caching to achieve something close to it -

Also in ES 1.4.0 , there is support for scripted aggregation. Which can
like implement any custom aggregation logic.
Hope these might help in your use case.

Thanks
Vineeth

On Thu, Oct 2, 2014 at 5:06 AM, Klaus Brunner klaus.brunner@gmail.com
wrote:

We're making extensive use of custom scoring (implemented in Java). One of
the problems we've encountered is that we'd love to get not just the score,
but other data that result from the score function out of Elasticsearch.
For example, this could be a flag marking certain documents, or some sort
of custom score explanation, or even another "score" (if you need multiple
dimensions perhaps).

So far, I haven't found any way of doing this. Search scripts simply
return a float. There doesn't seem to be anything like a "search context"
to decorate the returned results, at least not in the way I need it.

Any other ideas?

Thanks

Klaus

--
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/13e8367f-a2e6-4d70-8d7e-3e153200281a%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/13e8367f-a2e6-4d70-8d7e-3e153200281a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5ksO3L9iePjWm2dg%3DFj_-RJeG%2BdJMEg2fPi6BMZKY4rBQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hi Vineeth,

thanks for the hints, but I'm not sure I understand how this would help. A
filter script would allow me to remove documents from the next phase and
thus the result set, but there seems to be no way to annotate the results,
unless I'm missing something obvious here?

What I'm really looking for is a way to get more than a float out of
scoring (or maybe filtering if that's easier, though it makes more sense in
the scoring phase for us). So far we've had to work with some rather
"creative" solutions to pack more than a single value into the score, but
those are really nasty hacks.

Klaus

On Thursday, 2 October 2014 15:39:36 UTC+2, vineeth mohan wrote:

Hello Klaus ,

For document flagging or similar feature , you can use script filter with
caching to achieve something close to it -
Elasticsearch Platform — Find real-time answers at scale | Elastic

Also in ES 1.4.0 , there is support for scripted aggregation. Which can
like implement any custom aggregation logic.
Hope these might help in your use case.

Thanks
Vineeth

On Thu, Oct 2, 2014 at 5:06 AM, Klaus Brunner <klaus....@gmail.com
<javascript:>> wrote:

We're making extensive use of custom scoring (implemented in Java). One
of the problems we've encountered is that we'd love to get not just the
score, but other data that result from the score function out of
Elasticsearch. For example, this could be a flag marking certain documents,
or some sort of custom score explanation, or even another "score" (if you
need multiple dimensions perhaps).

So far, I haven't found any way of doing this. Search scripts simply
return a float. There doesn't seem to be anything like a "search context"
to decorate the returned results, at least not in the way I need it.

Any other ideas?

Thanks

Klaus

--
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 <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/13e8367f-a2e6-4d70-8d7e-3e153200281a%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/13e8367f-a2e6-4d70-8d7e-3e153200281a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c6572176-40ee-4532-82ec-e2e210f38803%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You may have a look at the "script_fields" feature: it allows to return one
or more script evaluation for each hit (but you can't use the score here).

If you want to compute multiple scores for the same set of results, you can
try to execute multiple function score queries with a custom
"script_score', but I don't see a way to get multiple scores in one query.

-- Tanguy

Le vendredi 3 octobre 2014 08:50:19 UTC+2, Klaus Brunner a écrit :

Hi Vineeth,

thanks for the hints, but I'm not sure I understand how this would help. A
filter script would allow me to remove documents from the next phase and
thus the result set, but there seems to be no way to annotate the results,
unless I'm missing something obvious here?

What I'm really looking for is a way to get more than a float out of
scoring (or maybe filtering if that's easier, though it makes more sense in
the scoring phase for us). So far we've had to work with some rather
"creative" solutions to pack more than a single value into the score, but
those are really nasty hacks.

Klaus

On Thursday, 2 October 2014 15:39:36 UTC+2, vineeth mohan wrote:

Hello Klaus ,

For document flagging or similar feature , you can use script filter with
caching to achieve something close to it -
Elasticsearch Platform — Find real-time answers at scale | Elastic

Also in ES 1.4.0 , there is support for scripted aggregation. Which can
like implement any custom aggregation logic.
Hope these might help in your use case.

Thanks
Vineeth

On Thu, Oct 2, 2014 at 5:06 AM, Klaus Brunner klaus....@gmail.com
wrote:

We're making extensive use of custom scoring (implemented in Java). One
of the problems we've encountered is that we'd love to get not just the
score, but other data that result from the score function out of
Elasticsearch. For example, this could be a flag marking certain documents,
or some sort of custom score explanation, or even another "score" (if you
need multiple dimensions perhaps).

So far, I haven't found any way of doing this. Search scripts simply
return a float. There doesn't seem to be anything like a "search context"
to decorate the returned results, at least not in the way I need it.

Any other ideas?

Thanks

Klaus

--
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/13e8367f-a2e6-4d70-8d7e-3e153200281a%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/13e8367f-a2e6-4d70-8d7e-3e153200281a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4b889421-e95a-4d12-92f0-971d511bfe39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hello Klaus ,

What i had in mind was , whenever you want to see the result with a
particular flag , apply the filter and see the result. The good thing here
is the filter result is cached and is not made again and hence you should
find closer performance.

Thanks
Vineeth

On Fri, Oct 3, 2014 at 12:20 PM, Klaus Brunner klaus.brunner@gmail.com
wrote:

Hi Vineeth,

thanks for the hints, but I'm not sure I understand how this would help. A
filter script would allow me to remove documents from the next phase and
thus the result set, but there seems to be no way to annotate the results,
unless I'm missing something obvious here?

What I'm really looking for is a way to get more than a float out of
scoring (or maybe filtering if that's easier, though it makes more sense in
the scoring phase for us). So far we've had to work with some rather
"creative" solutions to pack more than a single value into the score, but
those are really nasty hacks.

Klaus

On Thursday, 2 October 2014 15:39:36 UTC+2, vineeth mohan wrote:

Hello Klaus ,

For document flagging or similar feature , you can use script filter with
caching to achieve something close to it - http://www.elasticsearch.org/
guide/en/elasticsearch/reference/current/query-dsl-
script-filter.html#query-dsl-script-filter

Also in ES 1.4.0 , there is support for scripted aggregation. Which can
like implement any custom aggregation logic.
Hope these might help in your use case.

Thanks
Vineeth

On Thu, Oct 2, 2014 at 5:06 AM, Klaus Brunner klaus....@gmail.com
wrote:

We're making extensive use of custom scoring (implemented in Java). One
of the problems we've encountered is that we'd love to get not just the
score, but other data that result from the score function out of
Elasticsearch. For example, this could be a flag marking certain documents,
or some sort of custom score explanation, or even another "score" (if you
need multiple dimensions perhaps).

So far, I haven't found any way of doing this. Search scripts simply
return a float. There doesn't seem to be anything like a "search context"
to decorate the returned results, at least not in the way I need it.

Any other ideas?

Thanks

Klaus

--
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/13e8367f-a2e6-4d70-8d7e-3e153200281a%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/13e8367f-a2e6-4d70-8d7e-3e153200281a%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/c6572176-40ee-4532-82ec-e2e210f38803%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/c6572176-40ee-4532-82ec-e2e210f38803%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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nBLVk-BecM1-nusnvFdMMcsFmtfsYmyykEZ7gY4gv%3D9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.