I don't want a field date
to be indexed. So I disabled the dynamic
property. Here is my mapping:
curl localhost:9200/logstash-2016.09.16/rtds/_mapping?pretty
{
"logstash-2016.09.16" : {
"mappings" : {
"rtds" : {
"dynamic" : "false",
"_all" : {
"enabled" : false
},
"properties" : {
"@timestamp" : {
"type" : "date",
"format" : "strict_date_optional_time||epoch_millis"
},
"@version" : {
"type" : "string",
"index" : "no",
"doc_values" : true
},
"content" : {
"type" : "string",
"index" : "not_analyzed"
},
"host" : {
"type" : "string",
"index" : "not_analyzed"
},
"message" : {
"type" : "string",
"index" : "no",
"doc_values" : true
},
"path" : {
"type" : "string",
"index" : "not_analyzed"
},
"tags" : {
"type" : "string",
"index" : "not_analyzed"
},
"type" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
You can see there's no date
field in this mapping.
But When I search, the date
field appeared:
curl localhost:9200/logstash-2016.09.16/rtds/_search?pretty
{
"took" : 1093,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2624596,
"max_score" : 1.0,
"hits" : [ {
"_index" : "logstash-2016.09.16",
"_type" : "rtds",
"_id" : "AVcwSvrWxFnTKGlIg7xt",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2016-09-16T00:00:01.276Z",
"@version" : "1",
"path" : "/var/log/rtds/rtds.log",
"host" : "kaishan",
"type" : "rtds",
"tags" : [ "rtds", "vertx", "throttled" ],
"date" : "2016-09-16 08:00:01,276",
"loglevel" : "ERROR",
"content" : "找不到对应的iid信息:12 ,sid = 00003310 ,eid = 00003310",
"subject" : "找不到对应的iid信息:12 ,sid = 00003310 ,eid = 00003310"
}
}, {
"_index" : "logstash-2016.09.16",
"_type" : "rtds",
"_id" : "AVcwSvrWxFnTKGlIg7x5",
"_score" : 1.0,
"_source" : {
"@timestamp" : "2016-09-16T00:00:01.374Z",
"@version" : "1",
"path" : "/var/log/rtds/rtds.log",
"host" : "kaishan",
"type" : "rtds",
"tags" : [ "rtds", "vertx", "throttled" ],
"date" : "2016-09-16 08:00:01,374",
"loglevel" : "ERROR",
"content" : "找不到对应的iid信息:5 ,sid = 00002134 ,eid = 00002134",
"subject" : "找不到对应的iid信息:5 ,sid = 00002134 ,eid = 00002134"
}
}
...
You can see the date
appeared in the _source
. What's my fault?