Returning dateTime fields as timestamps


(Oliver B. Fischer) #1

Hi,

is there a way to return dateTime fields as unix timestamps and not in a
ISO 8601 representation?

Thanks in advance

Oliver

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/53148962.1000900%40swe-blog.net.
For more options, visit https://groups.google.com/groups/opt_out.


(Binh Ly-2) #2

You should be able to do something like this on a date field:

{
"script_fields": {
"epoch_ms": {
"script": "doc['datefield'].value"
}
}
}

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/19315c2c-e671-4241-b612-6c6785399a2b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Oliver B. Fischer) #3

Thanks. I totally forgot that it exists...

Am 03.03.14 21:00, schrieb Binh Ly:

You should be able to do something like this on a date field:

{
"script_fields": {
"epoch_ms": {
"script": "doc['datefield'].value"
}
}
}

--
You received this message because you are subscribed to the Google
Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/19315c2c-e671-4241-b612-6c6785399a2b%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/5314F75F.9000008%40swe-blog.net.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4