【发布时间】:2018-03-16 09:27:17
【问题描述】:
所以我使用 Elasticsearch 和 Kibana 来显示我的 Django 应用程序使用 elastic-py 发送的特定用户事件。我之前用的是5.5版本,效果很好,但是由于不同的原因,我不得不改变服务器本身,并决定利用这个机会升级到ELK 6.x。
因此,我在另一台装有 X-Pack 的服务器上安装了全新的 Elasticsearch 和 Kibana 6.2.2,并对我的旧代码进行了一些调整:
之前
. . .
'mappings': {
'example_local': {
'properties': {
'action': {'index': 'not_analyzed', 'type': 'string'},
'date': {'index': 'not_analyzed', 'format': 'dd-MM-yyyy HH:mm:ss', 'type': 'date'},
'user_type': {'index': 'not_analyzed', 'type': 'string'},
. . .
之后
. . .
'mappings': {
'example_local': {
'properties': {
'action': {'type': 'text'},
'date': {'format': 'dd-MM-yyyy HH:mm:ss', 'type': 'date'},
'user_type': {'type': 'text'},
. . .
之后,我将用户名和密码添加到我的连接中,这在我的旧 ELK 中无法做到。
host_port = '{}:{}'.format(settings.ELASTICSEARCH['host'], settings.ELASTICSEARCH['port'])
Elasticsearch(host_port, http_auth=(settings.ELASTICSEARCH['username'],settings.ELASTICSEARCH['password']))
最后,我创建了我的索引并跑到 Kibana 看看我最后 4 小时的努力最终是如何得到回报的。
但在 Management -> Kibana -> Index Patterns 中只有 1 个索引,haystack-test (我不知道它为什么在那里)。
【问题讨论】:
标签: python django elastic-stack elasticsearch-6 kibana-6