How does kibana displays available fields?


(Aravind Ram) #1

I am a newbie to ES. I am developing a small tool in my organisation to enable Querying the elastic search from a UI. I need to get all the fields available in the index. And I know kibana is fetching those fields from the mapping. But I wonder how does it fetch the available fields when we apply some filters. How does it fetch the fields available in the documents pertaining to the filter applied? Because the documents might not contain all the fields as in the mapping when the filter is applied.

Kindly help me to understand , how can I get the available fields list even when the filter is applied.

Thanks in advance.


(Tim Sullivan) #2

There is a mapping API provided by Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html

Each different kind of document in the index should have a different "type." Using types, you can define/retrive mapping for each of those kinds of documents. It doesn't matter what filters you apply, the mapping for the type will be the same for every document. Therefore, remember when indexing your data to not put different kinds of data together in one type.

developing a small tool in my organisation to enable Querying the elastic search from a UI

I'm sure that what you want to build is specific to your organization and your data, but just to let you know it already is possible to query Elasticsearch from a UI generically using the Sense plugin. That can help you get started learning and exploring the APIs such as the mapping APIs :slight_smile:


(system) #3