Painless - access non-analyzed version of analyzed text field

For every analyzed text field, ES creates by default a non-analyzed version for a text field under the name keyword.

We should be able to use it, however doc["text_field.keyword"].value doesn't work in painless.
It throws the error "index_out_of_bounds_exception".
For fields that don't exist I get a different error - "No field found for [text_field.keyword2] in mapping with types ", so it seems it should work.

Does this make sense? If yes, is there a workaround?

can you come up with a reproducible example please? including a sample document and the query that contains a script you are executing? Thanks!

I wrote an example to reproduce it but it worked, I can't seem to reproduce it.
Apparently painless supports this and something is wrong with my index, will update if I manage to understand how to reproduce it.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.