弹性搜索_timestamp [英] Elasticsearch _timestamp

查看:156
本文介绍了弹性搜索_timestamp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在索引上定义 _timestamp 属性。
首先,我创建索引

I tried to define the _timestamp property on an index. So first, I create the index

curl -XPUT'http:// elasticsearch:9200 / ppe /'

从服务器的响应: {ok:true,acknowledge:true}

然后我尝试使用 _timestamp

curl -Xput 'http://elasticsearch:9200/ppe/log/_mapping' -d '{
  "log": {
    "properties": {
      "_ttl": {
        "enabled": true
      },
      "_timestamp": {
        "enabled": true,
        "store": "yes"
      },
      "message": {
        "type": "string",
        "store": "yes"
      },
      "appid": {
        "type": "string",
        "store": "yes"
      },
      "level": {
        "type": "integer",
        "store": "yes"
      },
      "logdate": {
        "type": "date",
        "format": "date_time_no_millis",
        "store": "yes"
      }
    }
  }
}'

我从服务器收到答复

and I receive as answer from the server

{
  "error": "MapperParsingException[No type specified for property [_timestamp]]",
  "status": 400
}

推荐答案

特殊字段如 _ttl _timestamp 必须在与属性对象相同的级别上定义:

Special fields such as _ttl and _timestamp have to be defined on the same level as the properties object:

curl -Xput 'http://elasticsearch:9200/ppe/log/_mapping' -d '{
    "log": {
        "_ttl": {
            "enabled": true
        },
        "_timestamp": {
            "enabled": true,
            "store": "yes"
        },
        "properties": {
            "message": {
                "type": "string",
                "store": "yes"
            },
            "appid": {
                "type": "string",
                "store": "yes"
            },
            "level": {
                "type": "integer",
                "store": "yes"
            },
            "logdate": {
                "type": "date",
                "format": "date_time_no_millis",
                "store": "yes"
            }
        }
    }
}
'

这篇关于弹性搜索_timestamp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆