代码之家  ›  专栏  ›  技术社区  ›  sridesmet

日期映射在Kibana和ES中不起作用

  •  0
  • sridesmet  · 技术社区  · 7 年前

    我正在尝试在Elasticsearch中创建一个索引(通过Kibana的开发者控制台)。索引如下所示:

    PUT _template/example_index
    {
      "index_patterns": ["example_index*"],
      "settings": {
        "number_of_shards": 5,
        "number_of_replicas": 1
      },
      "mappings": {
        "track": {
          "properties": {
            "hash": {
              "type": "keyword"
            },
            "time": {
              "type": "date"
            }
          }
        }
      }
    }
    

    添加的文档中的时间如下所示:1537185147182

    2 回复  |  直到 7 年前
        1
  •  1
  •   Nusrath    7 年前

    我也有同样的问题,但解决了“忽略格式错误”

    下面是映射查询:

    PUT my_index
    {
      "settings": {
        "index.mapping.ignore_malformed": true 
      },
      "mappings": {
        "my_type": {
          "properties": {
        "Size": {"type": "integer","ignore_malformed": false },
        "Creation_Time": {"type": "date", "format": "dd MMM yyyy HH:mm:ss"}
          }
        }
      }
    }
    

        2
  •  0
  •   sridesmet    7 年前

    创建的索引和用于插入数据的索引具有不同的名称。因此elasticsearch使用动态方式,并按自己喜欢的方式创建它。

    更改索引名称修复了此问题。

        3
  •  0
  •   Jake    6 年前

    对于我来说,我最初在映射中有一个错误。我修复了它,删除并重建了索引。 您还必须在kibana中删除并重新创建索引模式。