Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consistent response format for dates #1326

Closed
outoftime opened this issue Sep 12, 2011 · 3 comments
Closed

Consistent response format for dates #1326

outoftime opened this issue Sep 12, 2011 · 3 comments

Comments

@outoftime
Copy link

The response format of a date in a search that specifies fields varies based on whether the field is marked store or not. If it is not stored, it will read from the source, and thus be in the same format as the source. If it is stored, it will read from the stored field and cast it to the default date format.

Example:

$ curl http://localhost:9200/test/test/_mapping?pretty=true
{
  "test" : {
    "properties" : {
      "created_at2" : {
        "store" : "yes",
        "format" : "dateOptionalTime",
        "type" : "date"
      },
      "created_at" : {
        "format" : "dateOptionalTime",
        "type" : "date"
      }
    }
  }
}

$ curl -XPUT http://localhost:9200/test/test/1 -d '{"created_at":1315847893000,"created_at2":1315847893000}'
{"ok":true,"_index":"test","_type":"test","_id":"1","_version":1}


$ curl 'http://localhost:9200/test/test/_search?fields=created_at,created_at2&pretty=true'
{
  "took" : 2,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "test",
      "_type" : "test",
      "_id" : "1",
      "_score" : 1.0,
      "fields" : {
        "created_at" : 1315847893000,
        "created_at2" : "2011-09-12T17:18:13.000Z"
      }
    } ]
  }
}
@damienalexandre
Copy link
Contributor

👍 (still happening in 0.9)

@loris
Copy link

loris commented Jul 1, 2013

👍

@clintongormley
Copy link

This has been fixed in #3301

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants