-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Get any value of a document in a field formatter #6416
Comments
Seems reasonable to pass the document in along with the value. Of course you'd be getting the unformatted value of the document, but you could apply whatever formatter you wanted at that point. |
@rashidkpc there is an issue in the case of a visualization that aggregates on the field To achieve this, I would need the |
I found a solution, but it works only with the data table visualization. In rows.js the return of the However, for other visualizations such as bar chart this object is not expected by the tooltip function https://github.com/elastic/kibana/blob/4c535f615500f78294726b4d087722bfa655c61e/src/ui/public/agg_response/point_series/_tooltip_formatter.js |
So I tried to add this feature to kibana but it is difficult to do because field formatters are not async. In some places I managed to add this feature:
However, I didn't manage to support this feature for the I think it would be better if the API of a field formatter expects it to be asynchronous, regardless of the content type ( |
Yeah, I totally agree, field formatter should be able to handle |
@scampi I don't think it makes sense for a field formatter to access other fields. Seems like you could do what you want in a scripted field, which has access to the entire document. I'm going to close this for now. Feel free to reopen if you disagree. |
@bmcconaghy i dont think what scampi wants can be done in a scripted field and its a perfectly valid and real world situation "who are the top people who did this" "john doe" "john doe" .. you want separate slices in the pie chart , ie. use the personID (not the mame) to aggregate. But you'd like a smarter tooltip that shows you the name instead of the ID. |
When formatting a field, I only have access to the value of that field. But I have a scenario where I need to display the value of another field.
To illustrate, let's say I have the following data. I have two people that have the same name, but are uniquely identifiable with the
id
field.Now, if I want to create an aggregation on my people data, I need to aggregate on the
id
field to have correct values.The problem is I don't want to display the value of the field
id
, but thename
.In my case, I also want to format the field as a URL.
It should be possible to specify which field to take the value from in the formatter, rather than simply proposing the parameters
value
andrawValue
of the current field.Also, this would be useful for any future formatter that makes some operation on the value.
The text was updated successfully, but these errors were encountered: