我是Kibana的新手,已将数据加载到Elastic 5.0.0-alpha3中,并且正在使用Kibana 5.0.0-alpha3进行可视化。我可以将一些数字字段显示为直方图,但是当我想使用文本字段时,我得到:
Visualize: Fielddata is disabled on text fields by default. Set fielddata=true on [publisher] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory.
警告我,数据(发布者的名称)可能已被分析成子字段,但无论如何我还是要显示。
我该如何设定fielddata=true
?
编辑:有关Kibana github的最新问题表明,这是5.0.0中的一项新功能,仍在等待答案!
编辑(遵循@Val的回答,并向Elastic新手寻求帮助,并希望其他人会发现它很有用)。摄取脚本为:
fs = require('fs')
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
});
fs.readFile('/Users/pm286/workspace/cmdev/getpapers/20160602/crossref_results.json', (err, data) => {
if (err) throw err;
document = JSON.parse(data)
document = JSON.parse(data)
for(i=0;i<document.length;i++) {
client.create({
index: 'index',
type: 'type',
body: document[i]
})
}
});
如何在其中包含@Val的方法?
在ES映射中,您需要fielddata:true
在publisher
字段中进行设置:
PUT your_index/_mapping/your_type
{
"your_type": {
"properties": {
"publisher": {
"type": "text",
"fielddata": true
}
}
}
}
进行此更改后,您需要重新索引数据,但是此后,Kibana不再抱怨。
更新
您可以在Sense UI中执行上述查询,也可以通过curl执行
curl -XPUT http://localhost:9200/index -d '{
"mappings": {
"type": {
"properties": {
"publisher": {
"type": "text",
"fielddata": true
}
}
}
}
}'
或者,也可以在创建文档之前在Javascript文件中执行它:
client.indices.create({
index: 'index',
body: {
"mappings": {
"type": {
"properties": {
"publisher": {
"type": "text",
"fielddata": true
}
}
}
}
}
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句