Return only the YYYY-MM-DDD from date field - can I do that with a script?

(carl) #1

I have some date type data coming back from a query, like the example below
field "signupDate". Can I query and have the date only return the calendar
date and drop the hours, minutes, etc. Would I do that with a script
field? This signup date is entered as system time and i can't change that,
but when I query it I just wan to see the signup date as a normal date.

    "hits": [
            "_index": "index1",
            "_type": "type1",
            "_id": "6ctRoz-0RI24Lu2FRZXwOQ",
            "_score": 1,
            "fields": {
                "signupDate": [
                "accountNumber": [


Here's the query I'm using:

{ "query": {"filtered": {
"query": {"match_all": {}},
"filter": {"range": {
"signupDate": {
"from": "2014-01-01",
"to": "2014-01-15"
"fields": [

The signupDate field is defined as:

                "signupDate": {
                    "type": "date",
                    "format": "dateOptionalTime"

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
To view this discussion on the web visit
For more options, visit

(system) #2