How to access document type in script?

Hi,

I'm using custom score query with script which should access object type of
document.
I want to search on more document types (same index), but not all types in
same index and for example, increment score of document if it is in array
of types.

How can I do this? Is there way to access to type of document in scriot,
something like:

doc['field'].type or similar ?

Thanks in advance

--
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/fbfcb372-d25a-46a8-8eb2-ebad1b19f34b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

I have never tried doing so, but doc['_type'].value should work.

What would probably work for your is a custom score filter using a filter
on the _type field.

elasticsearch 0.90.4+
Elasticsearch Platform — Find real-time answers at scale | Elastichttp://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-function-score-query.html#_score_functions

elasticsearch 0.90.3 and before

--
Ivan

On Wed, Dec 11, 2013 at 5:36 AM, aldm amer.zildzic@gmail.com wrote:

Hi,

I'm using custom score query with script which should access object type
of document.
I want to search on more document types (same index), but not all types in
same index and for example, increment score of document if it is in array
of types.

How can I do this? Is there way to access to type of document in scriot,
something like:

doc['field'].type or similar ?

Thanks in advance

--
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/fbfcb372-d25a-46a8-8eb2-ebad1b19f34b%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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/CALY%3DcQDBDGOyx-q62gihF9c9EP3oi-3uzj%2BsT7F_hA9MKFmU2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

1 Like

It works. Thank you very much.

On Wednesday, December 11, 2013 2:36:10 PM UTC+1, aldm wrote:

Hi,

I'm using custom score query with script which should access object type
of document.
I want to search on more document types (same index), but not all types in
same index and for example, increment score of document if it is in array
of types.

How can I do this? Is there way to access to type of document in scriot,
something like:

doc['field'].type or similar ?

Thanks in advance

--
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/2d2cff27-2523-4e4c-a003-ef2b87c70ce9%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.