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

Option to allow docvalue_fields of date types to return ms #27740

Closed
awick opened this issue Dec 9, 2017 · 2 comments
Assignees

Comments

@awick
Copy link

@awick awick commented Dec 9, 2017

Prior to ES 6 docvalue_fields on dates returned ms, now it returns a formatted date. Would be nice if that formatting could be specified, including allowing epoch_millis.

https://www.elastic.co/guide/en/elasticsearch/reference/current/date.html
Says that "The first format will be used to convert the milliseconds-since-the-epoch value back into a string.", so maybe this is a bug and not a feature request, but it doesn't seem to work.

@awick

This comment has been minimized.

Copy link
Author

@awick awick commented Dec 28, 2017

Code to reproduce

curl -H "Content-type: application/json" -XPUT http://localhost:9200/bug27740 -d '
{
"settings" : { "number_of_shards" : 1 },
  "mappings" : {
    "type1" : {
      "properties" : {
        "field1" : {
          "type" : "date",
          "format" : "epoch_millis"
        }
      }
    }
  }
}'

curl -H "Content-type: application/json" http://localhost:9200/bug27740/type1/1 -d '{"field1": 10}'
curl http://localhost:9200/bug27740/_flush
curl 'http://localhost:9200/bug27740/_search?pretty&docvalue_fields=field1'

ES 5 results:

        "fields" : {
          "field1" : [
            10
          ]
        }

ES 6 results:

       "fields" : {
          "field1" : [
            "1970-01-01T00:00:00.010Z"
          ]
        }
@andyb-elastic

This comment has been minimized.

Copy link
Contributor

@andyb-elastic andyb-elastic commented Mar 20, 2018

@elastic/es-search-aggs

jpountz added a commit to jpountz/elasticsearch that referenced this issue Apr 20, 2018
This commit adds the ability to configure how a docvalue field should be
formatted, so that it would be possible eg. to return a date field
formatted as the number of milliseconds since Epoch.

Closes elastic#27740
jpountz added a commit that referenced this issue May 23, 2018
This commit adds the ability to configure how a docvalue field should be
formatted, so that it would be possible eg. to return a date field
formatted as the number of milliseconds since Epoch.

Closes #27740
jpountz added a commit that referenced this issue May 23, 2018
This commit adds the ability to configure how a docvalue field should be
formatted, so that it would be possible eg. to return a date field
formatted as the number of milliseconds since Epoch.

Closes #27740
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.