# Add format to docvalues in elasticsearch js client request

**URL:** <https://discuss.elastic.co/t/add-format-to-docvalues-in-elasticsearch-js-client-request/239045>\
**Category:** Kibana\
**Created:** [June 29, 2020, 3:09am UTC](https://discuss.elastic.co/t/add-format-to-docvalues-in-elasticsearch-js-client-request/239045 "2020-06-29T03:09:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudosu](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sudosu](https://discuss.elastic.co/u/sudosu)\
**Post date:** [June 29, 2020, 3:09am UTC](https://discuss.elastic.co/t/add-format-to-docvalues-in-elasticsearch-js-client-request/239045/1 "2020-06-29T03:09:50Z")

</div>

Hi,  
Using the Elasticsearch client js, I am able to add the doc values to the request like so:

```auto
callWithRequest(_req, 'search', {
    index: indexPatternTitle,
    scroll: '1m',
    body: body,
    docvalue_fields:'timestamp'
});

```

But I want to be able to specify the format.  
In the console I can add the field "format": "MM/d/YYYY h:mm:ss a"

And the result will be formatted according to the format I specified.

But I am not able to pass the format using the js client.  
I tried passing an object with like:

```auto
{
    "field": "timestamp",
   "format": "MM/d/YYYY h:mm:ss a"
}

```

But it doesn't work.

Any Idea on How to do that? or could it even be done using the js client?

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 27, 2020, 3:10am UTC](https://discuss.elastic.co/t/add-format-to-docvalues-in-elasticsearch-js-client-request/239045/2 "2020-07-27T03:10:12Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
