# Use of tabifyAggResponse in kibana 6.1.x

**URL:** <https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512>\
**Category:** Kibana\
**Created:** [January 15, 2018, 9:57am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512 "2018-01-15T09:57:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![michimau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michimau/32/23262_2.png) [@michimau](https://discuss.elastic.co/u/michimau)\
**Post date:** [January 15, 2018, 9:57am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/1 "2018-01-15T09:57:02Z")

</div>

Dear community,

i am trying to make the computed\_columns plugin to work under Kibana 6.1.x.

> <https://github.com/seadiaz/computed-columns/blob/master/public/computed-columns-vis.js#L117-L121>

  
Invoking tabifyAggResponse results into: TypeError: esResponse.hits is undefined

"function tabifyAggResponse(vis, esResponse, respOpts) {  
var write = new TabbedAggResponseWriter(vis, respOpts);

```
var topLevelBucket = _lodash2.default.assign({}, esResponse.aggregations, {
  doc_count: esResponse.hits.total
});"

```

i have tried to use resp directly, but in that way i cannot set respOpts.

any clue?

best!  
michimau

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [January 15, 2018, 10:07am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/2 "2018-01-15T10:07:48Z")

</div>

Hi,

for visualizations we do a precheck if the `resp.hits.total` actually has results. So I think you should add a check to your code, that checks whether `resp.hits` exists and `resp.hits.total` is not equal 0. If it is, Elasticsearch will just have returned no results, in which case you cannot tabify anything.

Cheers  
Tim

---

<div class="post-metadata">

**Author:** ![michimau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michimau/32/23262_2.png) [@michimau](https://discuss.elastic.co/u/michimau)\
**Post date:** [January 15, 2018, 10:24am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/3 "2018-01-15T10:24:51Z")

</div>

thank you. however, resp object doesn't look to have hits in the first place:

resp.aggregations:undefined  
resp property: aggConfig null  
resp property: key null  
resp property: title null  
resp property: tables Array [{…}]  
resp property: field  
resp property: fieldFormatter

is it possible that something has changed in 6.x.x ☹

the response in the spy panel is:  
{  
"took": 4,  
"timed\_out": false,  
"\_shards": {  
"total": 15,  
"successful": 15,  
"skipped": 0,  
"failed": 0  
},  
"hits": {  
"total": 14005,  
"max\_score": 0,  
"hits": []  
},  
"status": 200  
}

---

<div class="post-metadata">

**Author:** ![michimau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michimau/32/23262_2.png) [@michimau](https://discuss.elastic.co/u/michimau)\
**Post date:** [January 15, 2018, 10:55am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/4 "2018-01-15T10:55:29Z")

</div>

in case of unstoppable curiosity :):

> <https://github.com/michimau/computed-columns/blob/6.1.x-dev/public/computed-columns-vis-controller.js#L115-L139>

---

<div class="post-metadata">

**Author:** ![timroes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/timroes/32/19712_2.png) [@timroes](https://discuss.elastic.co/u/timroes)\
**Post date:** [January 15, 2018, 11:13am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/5 "2018-01-15T11:13:04Z")

</div>

Hi,

I've checked your sources. When you [register your plugin](https://github.com/michimau/computed-columns/blob/6.1.x-dev/public/computed-columns-vis.js#L20:L67) you don't specify a `responseHandler` property. In this case the default (tabify) will be used. Meaning the `resp` you see, is already a tabified response.

You can either set `responseHandler: 'none'` in your vis registration to get the original ES response, or - more recommended - just use `resp` as the result of tabify, since you anyway want to tabify it.

Cheers,  
Tim

---

<div class="post-metadata">

**Author:** ![michimau](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michimau/32/23262_2.png) [@michimau](https://discuss.elastic.co/u/michimau)\
**Post date:** [January 15, 2018, 11:22am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/6 "2018-01-15T11:22:21Z")

</div>

thank you so much!!!

---

<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:** [February 12, 2018, 11:22am UTC](https://discuss.elastic.co/t/use-of-tabifyaggresponse-in-kibana-6-1-x/115512/7 "2018-02-12T11:22:47Z")

</div>

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