es查询时间long转date_在Elasticsearch查询中格式化日期(在检索过程中)

小编典典

在Elasticsearch中运行查询时,您可以请求其返回原始数据,例如,指定字段:

curl -XGET http://localhost:9200/myindex/date-test/_search?pretty -d '

{

"fields" : "aDate",

"query":{

"match_all":{

}

}

}'

将以您最初存储日期的格式为您提供日期:

{

"_index" : "myindex",

"_type" : "date-test",

"_id" : "AUrlWNTAk1DYhbTcL2xO",

"_score" : 1.0,

"fields" : {

"aDate" : [ "2015-01-13T20:08:56" ]

}

}, {

"_index" : "myindex",

"_type" : "date-test",

"_id" : "AUrlQnFgk1DYhbTcL2xM",

"_score" : 1.0,

"fields" : {

"aDate"

你可能感兴趣的:(es查询时间long转date)