Elasticsearch将数据显示为Kibana中的缓冲区类型
我试图将一个JSON索引到弹性搜索。
它似乎没有任何错误,因为它没有任何错误。
我的索引文档如下。
await client.index({
id: fieldId.toString(),
index: 'project_documents_textfielddata',
body: {
FieldId: fieldId,
DocumentId: documentId,
Value: fieldData.fieldHTMLText,
},
routing: projectId.toString(),
});
但是在Elasticsearch Kibana中,它显示为缓冲类型(如下所示,我已经截断了缓冲区,因为很长)。
{
"_index": "documenttextfile.files",
"_id": "6252ab411deaba21fd877c26",
"_version": 1,
"_score": 1,
"_routing": "62505a765ff176cd491f1d1e",
"_source": {
"id": "6252ab411deaba21fd877c26",
"Content": {
"type": "Buffer",
"data": [
10,
// Some extra large binary content removed for convenient
48,
56,
50,
],
"id": [
"6252ab411deaba21fd877c26"
],
"Content.type.keyword": [
"Buffer"
]
}
}
因此,如何在Kibana中查看我的数据(即JSON格式)。我已经看到了关于木基纳(Kibana)的许多教程,他们能够以纯文本而不是缓冲区看到数据。
还是我在索引时做错了什么?我基本上试图以我们在MongoDB指南针中看到的方式查看数据。
I am trying to index one json to elastic search.
It seems to be working fine as it is not giving any error.
I have indexed document as below.
await client.index({
id: fieldId.toString(),
index: 'project_documents_textfielddata',
body: {
FieldId: fieldId,
DocumentId: documentId,
Value: fieldData.fieldHTMLText,
},
routing: projectId.toString(),
});
But in elasticsearch kibana it is showing as buffer type as below (I have truncated buffer as it was very long).
{
"_index": "documenttextfile.files",
"_id": "6252ab411deaba21fd877c26",
"_version": 1,
"_score": 1,
"_routing": "62505a765ff176cd491f1d1e",
"_source": {
"id": "6252ab411deaba21fd877c26",
"Content": {
"type": "Buffer",
"data": [
10,
// Some extra large binary content removed for convenient
48,
56,
50,
],
"id": [
"6252ab411deaba21fd877c26"
],
"Content.type.keyword": [
"Buffer"
]
}
}
So how can I see my data as is (i.e. in json format) in Kibana. I've seen many tutorials on Kibana, they are able to see data in plain text instead of buffer.
Or am I doing anything wrong while indexing? I am basically trying to see the data the way we can see in mongodb compass.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
fielddata.fieldhtmltext
字段可能是类型buffer
,您只需要调用fielddata.fielddata.fieldhtmltext.tostring()
在其上即可转换缓冲区到字符串。PS:问题与Kibana无关,它完全显示您发送给Elasticsearch的内容,即缓冲区。因此,问题与您对Node.js数据结构(IE缓冲区与字符串)的了解更相关;-)
Your
fieldData.fieldHTMLText
field is probably of typeBuffer
and you simply need to callfieldData.fieldHTMLText.toString()
on it in order to transform the buffer to a string.PS: the problem has nothing to do with Kibana which shows you exactly what you're sending to Elasticsearch, i.e. a Buffer. So the problem is more related to your understand of Node.js data structures (i.e. Buffer vs string) ;-)