For length parameter in scripted fields its returning length of unique values in a doc

Hello,

Length of string is 5 , but why is it returning 3 by counting only unique characters ?

Same with words in a string

Hi @Pranusha119,

try doc['special_char.keyword'].value.length()

Let me know if that's what you expect to get.

Hi @Marta_Bondyra

It's retuning 1 instead of 5

Oh ok, sorry, I didn't understand your question before – unfortunately, to my knowledge you cannot do it – once you index your field as keyword, it will only count unique values. Maybe you could add a string field at indexing time that would store all the characters as a string and then you could print out the string length?

I don't have any other ideas, maybe someone else has.

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