How to access fields with special characters from _source?

148 views Asked by At

I am creating a search application in React using searchkit. Some of the fields in my _source have special characters in the beginning, like _index or @timestamp. I am not able to access those fields using source._index, the way I can access fields without special characters, like source.Body.

My sourceFilter looks like this:

sourceFilter={["@timestamp", "From", "MessageStatus", "SmsStatus", "To", "Message", "Timestamp", "Body", "_index"]}

I am trying to access the fields to set the html using dangerouslySetInnerHtml.

How can I either change what the field is called or access a field with a special character?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

In the end, I created a new field in the elasticsearch index with a name that doesn't have special characters.