diff --git a/README.md b/README.md index c4a6356a983d2..4678c60c86fc8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Kibana is an open source (Apache Licensed), browser based analytics and search d You're up and running! Fantastic! Kibana is now running on port 5601, so point your browser at http://YOURDOMAIN.com:5601. -The first screen you arrive at will ask you to configure an **index pattern**. An index pattern describes to kibana how to access your data. We make the guess that you're working with log data, and we hope (because it's awesome) that you're working with Logstash. By default, we fill in `logstash-*` as your index pattern, thus the only thing you need to do is select which field contains the timestamp you'd like to use. Kibana reads your Elasticsearch mapping to find your time fields - select one from the list and hit *Create*. +The first screen you arrive at will ask you to configure an **index pattern**. An index pattern describes to Kibana how to access your data. We make the guess that you're working with log data, and we hope (because it's awesome) that you're working with Logstash. By default, we fill in `logstash-*` as your index pattern, thus the only thing you need to do is select which field contains the timestamp you'd like to use. Kibana reads your Elasticsearch mapping to find your time fields - select one from the list and hit *Create*. **Tip:** there's an optimization in the way of the *Use event times to create index names* option. Since Logstash creates an index every day, Kibana uses that fact to only search indices that could possibly contain data in your selected time range. @@ -128,7 +128,7 @@ Or HTML status:[400 TO 499] AND (extension:php OR extension:html) ``` -While lucene query syntax is simple and very powerful, Kibana also supports the full elasticsearch, JSON based, query DSL. See the [Elasticsearch documentation](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax) for usage and examples. +While Lucene query syntax is simple and very powerful, Kibana also supports the full Elasticsearch, JSON based, Query DSL. See the [Elasticsearch documentation](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax) for usage and examples. ## Visualize @@ -163,7 +163,7 @@ To the right of the search box there are a row of icons for creating new visuali #### Aggregation Builder -The aggregation builder on the left of the screen is used for configuring the [metric](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html#_metrics_aggregations) and [bucket](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html#_bucket_aggregations) aggregations used to create a visualization. (If you are coming from the SQL world, buckets are similar to group-bys. Check out the [elasticsearch docs](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html) for more info) For a bar chart or line chart the *metric* is used for the y-axis and the *buckets* are used for the x-axis, segment bar colors, and row/column splits. For pie charts the "metric" is used for the size of the slice and the *bucket* is used for the number of slices. Other visualizations may use these in new and different ways. +The aggregation builder on the left of the screen is used for configuring the [metric](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html#_metrics_aggregations) and [bucket](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html#_bucket_aggregations) aggregations used to create a visualization. (If you are coming from the SQL world, buckets are similar to group-bys. Check out the [Elasticsearch docs](http://www.elasticsearch.org/guide/en/elasticsearch/reference/1.x/search-aggregations.html) for more info) For a bar chart or line chart the *metric* is used for the y-axis and the *buckets* are used for the x-axis, segment bar colors, and row/column splits. For pie charts the "metric" is used for the size of the slice and the *bucket* is used for the number of slices. Other visualizations may use these in new and different ways. For the remainder of this documentation we are going to use the bar chart as our example when discussing the features of the aggregation panel. The same concepts apply to the other visualizations but the bar chart is the workhorse of the visualization world. diff --git a/src/kibana/apps/visualize/editor/agg.html b/src/kibana/apps/visualize/editor/agg.html index 85290957ef0f0..911a1229551c1 100644 --- a/src/kibana/apps/visualize/editor/agg.html +++ b/src/kibana/apps/visualize/editor/agg.html @@ -76,7 +76,7 @@ class="form-control" ng-model="agg.type" required - ng-options="agg as agg.title for agg in aggTypeOptions"> + ng-options="agg as agg.title for agg in aggTypeOptions | aggFilter:agg.schema.aggFilter"> diff --git a/src/kibana/apps/visualize/editor/agg_filter.js b/src/kibana/apps/visualize/editor/agg_filter.js new file mode 100644 index 0000000000000..e839c639329c9 --- /dev/null +++ b/src/kibana/apps/visualize/editor/agg_filter.js @@ -0,0 +1,36 @@ +// Gets all fields of a given type. +// You may also pass "*" to get all types +// Or an array of types to get all fields of that type +define(function (require) { + var _ = require('lodash'); + + require('modules') + .get('kibana') + .filter('aggFilter', function () { + return function (aggs, names) { + if (!names) return aggs; + if (!_.isArray(names)) names = [names]; + if (_.contains(names, '*')) return aggs; + + var filters = names.map(function (name) { + var filter = { + match: true, + name: name + }; + + if (name.charAt(0) === '!') { + filter.match = false; + filter.name = name.substr(1); + } + return filter; + }); + + return aggs.filter(function (agg) { + for (var i = 0; i < filters.length; i++) { + var filter = filters[i]; + if ((agg.name === filter.name) === filter.match) return true; + } + }); + }; + }); +}); \ No newline at end of file diff --git a/src/kibana/apps/visualize/editor/editor.js b/src/kibana/apps/visualize/editor/editor.js index 95d1c7b875937..c078a5e6091ad 100644 --- a/src/kibana/apps/visualize/editor/editor.js +++ b/src/kibana/apps/visualize/editor/editor.js @@ -1,6 +1,7 @@ define(function (require) { require('apps/visualize/saved_visualizations/saved_visualizations'); require('apps/visualize/editor/sidebar'); + require('apps/visualize/editor/agg_filter'); require('directives/saved_object_finder'); require('components/visualize/visualize'); diff --git a/src/kibana/components/vis_types/_schemas.js b/src/kibana/components/vis_types/_schemas.js index 85a45dbb58df6..4b1b4621812ca 100644 --- a/src/kibana/components/vis_types/_schemas.js +++ b/src/kibana/components/vis_types/_schemas.js @@ -26,6 +26,7 @@ define(function (require) { max: Infinity, group: 'buckets', title: schema.name, + aggFilter: '*', editor: false, params: [] }); diff --git a/src/kibana/components/vis_types/pie.js b/src/kibana/components/vis_types/pie.js index d690425a90708..8079d26c266ce 100644 --- a/src/kibana/components/vis_types/pie.js +++ b/src/kibana/components/vis_types/pie.js @@ -21,6 +21,7 @@ define(function (require) { title: 'Slice Size', min: 1, max: 1, + aggFilter: 'count', defaults: [ { schema: 'metric', type: 'count' } ]