java - Kibana 的 Timelion : Field [timestamp_ms] of type [text] does not support custom time zones

标签 java elasticsearch apache-spark twitter kibana

大家!

我正在尝试使用 Apache Spark、Elasticsearch 和 Kibana 实时分析推文流。作为 X 轴,我希望获得推文的“timestamp_ms”属性的值,作为 Y 轴,我希望获得唯一用户 ID 的数量,从而获得推文的覆盖范围。

但是,当我尝试创建索引时,选中“索引包含基于时间的事件”复选框并指定下面的属性,我遇到了一个问题,稍后我将对此进行解释。

curl -XPUT 'localhost:9200/twitter?pretty' -d'
{
  "mappings": {
    "tweet": {
      "properties": {
        "timestamp_ms": {
          "type":   "date",
          "format": "yyy-MM-dd HH:mm:ss||yyyy-MM-dd||epoch_millis"
        }
      }
    }
  }
}'

问题是,当我开始将推文流式传输到 ES 中时,我无法使用 Timelion 显示它们,因为发生了以下错误:

org.elasticsearch.transport.RemoteTransportException: [e1S9kLk][127.0.0.1:9300][indices:data/read/search[phase/query]]
Caused by: java.lang.IllegalArgumentException: Field [timestamp_ms] of type [text] does not support custom time zones
    at org.elasticsearch.index.mapper.MappedFieldType.docValueFormat(MappedFieldType.java:453) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.config(ValuesSourceAggregationBuilder.java:374) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.resolveConfig(ValuesSourceAggregationBuilder.java:305) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:299) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuilder.doBuild(ValuesSourceAggregationBuilder.java:49) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.AbstractAggregationBuilder.build(AbstractAggregationBuilder.java:126) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.AggregatorFactories$Builder.build(AggregatorFactories.java:211) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.AggregatorFactory.<init>(AggregatorFactory.java:187) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregatorFactory.<init>(FiltersAggregatorFactory.java:48) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregationBuilder.doBuild(FiltersAggregationBuilder.java:176) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.AbstractAggregationBuilder.build(AbstractAggregationBuilder.java:126) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.aggregations.AggregatorFactories$Builder.build(AggregatorFactories.java:211) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.SearchService.parseSource(SearchService.java:731) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.SearchService.createContext(SearchService.java:553) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:529) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:264) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:300) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:297) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.transport.TransportService$6.doRun(TransportService.java:577) [elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527) [elasticsearch-5.1.1.jar:5.1.1]
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.1.1.jar:5.1.1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
    at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]

我已尝试设置以下内容,但仍然不起作用:

timelion:es.timefield (Default: @timestamp) -> SET TO timestamp_ms

timelion:es.default_index (Default: _all) -> SET TO twitter

任何有关如何解决此问题的想法都值得赞赏,因为我进行了大量研究,但找不到任何适合我的东西。

谢谢!

最佳答案

尝试删除索引和索引模式,再次对索引运行 PUT 请求,开始写入 Elasticsearch,然后再次创建索引模式。然后它应该会显示在 Kibana Discover 上。

关于java - Kibana 的 Timelion : Field [timestamp_ms] of type [text] does not support custom time zones,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41382829/

相关文章:

java - 从文本中导入单词

elasticsearch - elasticsearch节点有多少个分片

java - 如何从Spark中的序列文件中提取行的范围?

apache-spark - pyspark ml 推荐 - Als 推荐

elasticsearch - Elasticsearch聚合

apache-spark - 如何在 Spark 中检索 DataFrame 的别名

java - 清理未修剪的字符串空白

java - Eclipse IDE - 通过通用文本编辑器扩展点突出显示 Costum 语言语法

java序列化自定义链表

elasticsearch - 如何在elasticsearch中同时搜索嵌套字段中单个对象的两个字段