简体   繁体   English

如何从_source访问带有特殊字符的字段?

[英]How to access fields with special characters from _source?

I am creating a search application in React using searchkit. 我正在使用searchkit在React中创建一个搜索应用程序。 Some of the fields in my _source have special characters in the beginning, like _index or @timestamp. 我的_source中的某些字段开头都有特殊字符,例如_index或@timestamp。 I am not able to access those fields using source._index, the way I can access fields without special characters, like source.Body. 我无法使用source._index访问这些字段,也无法访问没有特殊字符(例如source.Body)的字段。

My sourceFilter looks like this: 我的sourceFilter看起来像这样:

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

I am trying to access the fields to set the html using dangerouslySetInnerHtml. 我正在尝试使用危险地设置InnerHtml访问字段来设置html。

How can I either change what the field is called or access a field with a special character? 如何更改字段的名称或访问具有特殊字符的字段?

最后,我在elasticsearch索引中创建了一个新字段,其名称没有特殊字符。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在反应中从我的姓名输入字段中过滤特殊字符和空格? - How can I filter special characters and spaces from my name input fields in react? 如何从 objectArray 访问 object 的字段 - How to access fields of an object from an objectArray 删除字符串末尾的所有特殊字符 - Remove all special characters from the end of a string 如何在输入的按键上停止允许特殊字符 - How to stop allowing of special characters on keypress of input 如何使用键中的特殊字符在 React 中解构 object - How to destructure object in React with special characters in key 如何限制用户在反应 class 组件中的文本输入字段中输入数字或特殊字符 - How to restrict user from entering numbers or special characters in to text input field in react class components 从 HackerNewsApi 后端接收的 HTML 标签和特殊字符,未在视图中解码 - HTML tags and special characters received from backend of HackerNewsApi, not decoded in the view 如何访问 mongoose 填充字段? - How to access mongoose populated fields? React:如何通过包含特殊字符的路径加载图像? - React: How to load an image by path that contains special characters? 如何防止用户使用jsx在表单中粘贴特定的特殊字符(仅允许的字符包括(_-。) - How to prevent a user pasting specific special characters (only allowed characters include (_ - .) in a form using jsx
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM