I am currently working on a search page for my application. Since I already have a front-end I couldn't use Kibana directly, but I like some ideas such as the stats displayed in available fields.
So, how does Kibana gets this info? Is it possible to have those stats for all occurrences in ES?
the (experimental) field stats api might be helpful for your purposes. Depending on your specific requirements, the mapping api could also be of interest.
I knew about mapping API, actually that's how I am retrieving all fields from my documents. For finding top values I checked Aggregations
This gives me the information I want but it's kind of "manual". I mean I have to first make mappings and then for every field retrieved I have to perform an aggregation query. Is there anything to make it in a single query?
The field stats api I linked above should give you the min and max values for each field in one query even for dynamic mappings.
Thanks @weltenwort. But I am more interested in how many different values and its distribution we have for certain attributes (i.e: country) rather than that kind stats. Maybe my question wasn't clear.
The answers to those questions are quite computationally expensive and highly dependent on the semantics of the individual type. That is why Elasticsearch can not do that for you in the general case. I don't see a way around executing aggregations appropriate for each particular field in your application code.
Also, please note that cardinality aggregation results are only approximate.
Since you initially asked how Kibana gets the available field stats: It fetches the documents and calculates those stats on the client side right now.
Sorry I can not present you with a more satisfying solution.
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.