How to generalize the kibana visualization (bar chart) - kibana-5

In Kibana visualization (bar chart), i have created the bar chart for one of the index pattern (eg: Aircel), I have created the another index pattern (eg: Nationwide), having the similar columns for both index patterns with different data.
My Question is how can create a common visualization of Bar char (called as bar chart template) so that it can be used for both Aircel and Nationwide indexes.
can you please help me on this. Thanks in advance.

You can not use one visualization for two indexes. You can save them as same index, but two different types and then create visualization for both types on same bar chart. If you do not want to do this, you can create a dashboard and add both bar charts from different indexes there, so you will have them on the same page, but not on the same visualization
Hope that helps

You can actually accommodate data from multiple indices inside the same Kibana visualization.
Create an index that represents multiple indices having similar fields or the indices you want to compare by naming "*" or anything like that.
Create the Y axis using "counts" aggregation or "sum" of "total" or whatever aggregation used in your data.
Create the X axis first using "Terms" aggregation using your data specified fields. Then add a sub-bucket "Split Series" upon that using "Terms" aggregation with the Field as "_index" or "_type" according to your data.

Related

How can I create a list of values for a field in Kibana?

I am using Kibana to view data from Elasticsearch index. There is a field only has a few values. When I do search the field, how can I make the search bar as a select rather than a free text input? I know that there is a filter list like below image:
but it doesn't work for the case that top 5 values in 500 records have one value. How can I show all values in the history as a list for a field?
I think your are looking for "controls" visualization.
Go to visualization > controls
Then choose option list, your index and your field.
The result will be a dropdown with values like if you did a select distinct on your field within the whole kibana range.
Add it to a dashboard to have a filtering interface human usable dashboard.
Update:
Maybe a simple filter on the discover page can answer to your question.

Creating pie chart by sum of values in Kibana

I have an index in Elasticsearch with data that looks like this:
"_source": {
"segments": [
{
"segmentType": "Indirect",
"segmentCount": 100
},
{
"segmentType": "Direct",
"segmentCount": 20
}
]
}
I want to create a pie chart in Kibana where it takes the sum of segment count of each segment type. Currently, I only have the data above. So the pie chart should be split about: 83% for indirect and about 17% for direct. However, when I try to create a pie chart it is being split by 50% each. For slice size, I'm doing a sum of segment count and for split slices I'm doing a terms aggregation by the segment count field.
How can I achieve the result I want?
Old post but in case someone is still looking.
As far as I know it is not possible with the current version of Kibana (7.11) to create a pie chart using "sum of field value" to split slices, which is my understanding of what you were trying to do here.
In recent kibana versions the "Percentage Bar" visualization seems to be the way to present the percentage split you seek.
There is a related but old post (2017) on the elastic forum discussing 2 workaround options.
https://discuss.elastic.co/t/simple-pie-chart-question/92749
Ingesting the data (in these case it would be Indirect/Direct) as separate documents to be able to use the available aggregations.
Creating an alternate visualization type, though I believe the more recent "Percentage bar" would fit the purpose.

add average value of data in existing chart elasticsearch kibana

I have a project in kibana integrated with elastic search.
In Kibana page I am displaying a chart with X(months) and Y(Euro) values.
I want to show a line in the chart that will show the average Euro value of all data.
For the moment I add a manual value to show the horizontal line in the chart. Chart example I want to show
I want to get average value automatically from my data in elastic search. Is there any option to do this task?
Thank you
Considering it is timeseries data, timelion can be used.
I have created dummy data as follows:
POST /balance_new/doc?pretty
{
"#timestamp": "2018-01-14T12:32:50.548Z",
"amount":136.5
}
There are more entries present like this.
Timelion query:
.es(index='balance_new', timefield='#timestamp', metric=avg:amount).range(135,140).title('Average EUR Monthly').yaxis(label='Average EUR'),
.es(index='balance_new', timefield='#timestamp', metric=avg:amount).aggregate(function=avg)
Graph look like:
You can read more about timelion here: https://www.elastic.co/guide/en/kibana/current/timelion.html

Read query parameter from URL in Kibana-5.1 search query i.e as a placeholder

I am new to Kibana and using it for visualising the data present in Elastic Search.
I am trying to create dynamic dashboard i.e. by using saved search indexes having field values as variable.
What I want
Want to use place holders in the query which can be populated from URL parameters and then search results rendered in dashboard.
So that user can search results by providing some input instead of fixed query.
Can it be done in Kibana? If not, is there any better visualisation tool other than Kibana to serve this purpose.
In the Dashboard View there is actually a searchbar where you can just fire normal Matchqueries and its easy to filter i.e:
Create a table with terms aggregation for one of the fields a user might be interested in.
Click on one of the Terms in the Dashboard
A filter can be seen under the searchbar and all elements in the dashboard will be filtered with it.
If you have line charts users can zoom into the charts to see only information of the zoomed in timeframe
Barcharts are interactive like tables
Play around a bit. Kibana is very powerful you just have to find the right visualizations.

different field according to categories

im trying to use elasticsearch to search through products. If product is a car for instance, it will have some field like "color", "brand", "model", "km", ...
If it is clothes, it will only have "color", "size", ...
I would like to index all this info in elastic to be able then to search cars with km between aaa km and bbb km, and / or xxxx model, same for clothes or any other products.
how can I create such field(s) in elasticsearch ? I want all products to be in same index, so user can search through all products, but also if user search a type a product, then he should be able to specify some more details according to this kind of product.
I was thinking about array field, but does that mean that all products will have all fields corresponding to all type of products even if some fields are not relevant with some products (ie clothes will have km field ??) ? Or is it possible on indexing to put just info needed corresponding to each product ?
thanks
You could use types. Create a type called car with fields color, brand, model, k etc. and then a type called cloth with fields color, size, etc.
A single index can have many types. The following two links might help you in this:
Creating indices
Creating types and mapping to the index
You could easily search across types so that you could issue a search like this to return all documents form all types within that index:
curl -XGET http://localhost:9200/_search?pretty=true -d '{"query":{"matchAll":{}}}'
Additional information - Searching across types
Having an array field is not a good idea since you would not be utilizing the ability of elasticsearch to index semi structured documents.
All the best.

Resources