# Get Row Data from Field Formatter

**URL:** <https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969>\
**Category:** Kibana\
**Created:** [July 5, 2017, 6:21pm UTC](https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969 "2017-07-05T18:21:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan\_t](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://discuss.elastic.co/u/bryan_t)\
**Post date:** [July 5, 2017, 6:21pm UTC](https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969/1 "2017-07-05T18:21:25Z")

</div>

I am trying to make a field formatter that allows user to change the value of a cell directly from Kibana Discovery.  
To do that, I need to make a request to Elasticsearch to update that cell, but I need the \_id to do that.  
Is there an easy way to get the _id of the row_? It's also nice to get other cells in the row, but not required.

From my understanding, after a field formatter is registered, Kibana simply calls the \_convert function and takes the returned string.

What I have been trying is having the \_convert method return a hardcoded onChange, such as:

```auto
return `<select onChange="myCustFunc(this)">
    ...
</select>`

```

and then defining a hack that defines `window.myCustFunc`, uses `angular.element(e).scope()` to get the scope, and then sends ajax request to a hapijs endpoint defined in the plugin.

However, the .scope() function on works with debug info on, which would not be good for production.

So, my question is: Is there a good way to get the data of the row/elasticsearch id of the cell from a field formatter? (ex: returning an angular element instead of a string)

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [July 5, 2017, 7:22pm UTC](https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969/2 "2017-07-05T19:22:44Z")

</div>

The arguments passed to the `_convert` function are `rawValue`, `field`, and `hit`. So you should be able to access `hit._id`. Hope that helps!

---

<div class="post-metadata">

**Author:** ![bryan\_t](https://avatars.discourse-cdn.com/v4/letter/b/7bcc69/32.png) [@bryan\_t](https://discuss.elastic.co/u/bryan_t)\
**Post date:** [July 5, 2017, 7:51pm UTC](https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969/3 "2017-07-05T19:51:23Z")

</div>

That was exactly what I was looking for!

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:** [August 2, 2017, 7:52pm UTC](https://discuss.elastic.co/t/get-row-data-from-field-formatter/91969/4 "2017-08-02T19:52:14Z")

</div>

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