Doc['field']. value not returning the correct value

`indent preformatted text by 4 spaces`

Hi Guys,

Very new to painless scripting and have the simplest of scripted fields which is not working. I am trying to extract a pattern from doc["message"] field but it fails.
So I was looking at the value returned by doc["message"].value and its not same
as the actual value in the field.

I am getting value returned as "0000" highlighted in yellow (image below) where as the actual value can be seen along with it. (screenshot of preview results).

What am I missing here . I am sure its something very basic.

Thanks

Ravi

Hi

Might be an issue with your mapping, could you share the mapping of the "message" field?

Thx & best,
Matthias

Hi Matw,

Thanks for your quick response.

I switched to using message.keyword instead and its working fine.

Thanks

Ravi

1 Like

Sorry this issue is not resolved yet. The value returned for doc["message"].value is still incorrect (see first comment).

The mapping for the field is below

   "message" : {
      "type" : "text",
      "fields" : {
        "keyword" : {
          "type" : "keyword",
          "ignore_above" : 1000
        }
      }
    },

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