From c204689df8a6d87bf17f2c9cb14299b80ebf0d04 Mon Sep 17 00:00:00 2001 From: Chris Cowan Date: Fri, 25 Apr 2014 11:01:35 -0700 Subject: [PATCH] Sense KB Additions for 1.2 - Closes #173 - Adding significant_terms to KB - Closes #172 - Adding percentiles to KB - Closes #171 - Adding cardinality agg to KB - Closes #176 - Removing custom_score and custom_boost_factor from query for 1.0 - Closes #178 - Add script support to value_count agg - Closes #180 and Closes #179 - Adding _cat/plugins and _cat/segments endpoints - Closes #191 --- sense/app/kb/api_1_0/aggregations.js | 46 +++++++++++++++++++++++++--- sense/app/kb/api_1_0/cat.js | 4 ++- sense/app/kb/api_1_0/query.js | 20 +----------- 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/sense/app/kb/api_1_0/aggregations.js b/sense/app/kb/api_1_0/aggregations.js index 76cf3e0d0c46d..ffde1f2791d39 100644 --- a/sense/app/kb/api_1_0/aggregations.js +++ b/sense/app/kb/api_1_0/aggregations.js @@ -28,8 +28,13 @@ define(function () { "stats": simple_metric, "extended_stats": simple_metric, "value_count": { - __template: { field: ""}, - field: "{field}" + __template: { + "field": "" + }, + "field": "{field}", + "script": "_value", + "params": {}, + "lang": "mvel" }, "global": {}, "filter": {}, @@ -63,7 +68,19 @@ define(function () { // TODO: these also support regex - extend! "include": "*", "exclude": "*", - "execution_hint": { __one_of: ["asc", "desc"] } + "execution_hint": { __one_of: ["map", "ordinals", "global_ordinals"] } + }, + "significant_terms": { + __template: { + "field": "" + }, + "field": "{field}", + "size": 10, + "shard_size": 10, + "min_doc_count": 10, + "include": "*", + "exclude": "*", + "execution_hint": { __one_of: ["map", "ordinals", "global_ordinals"] } }, "range": { __template: { @@ -185,6 +202,27 @@ define(function () { "precision": { __one_of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]}, "size": 10, "shard_size": 10 + }, + "percentiles": { + __template: { + "field": "" + }, + "field": "{field}", + "percents": [], + "script": "_value", + "params": {}, + "lang": "mvel", + "compression": 100 + }, + "cardinality": { + __template: { + "field": "" + }, + "precision_threshold": 100, + "rehash": true, + "script": "_value", + "params": {}, + "lang": "mvel" } } @@ -195,4 +233,4 @@ define(function () { api.addGlobalAutocompleteRules('aggs', rules); }; -}); \ No newline at end of file +}); diff --git a/sense/app/kb/api_1_0/cat.js b/sense/app/kb/api_1_0/cat.js index c02bafa9dcb29..e436058ce5fb7 100644 --- a/sense/app/kb/api_1_0/cat.js +++ b/sense/app/kb/api_1_0/cat.js @@ -38,5 +38,7 @@ define(["_"], function (_) { addSimpleCat('_cat/recovery', api); addSimpleCat('_cat/thread_pool', api); addSimpleCat('_cat/shards', api); + addSimpleCat('_cat/plugins', api); + addSimpleCat('_cat/segments', api); }; -}); \ No newline at end of file +}); diff --git a/sense/app/kb/api_1_0/query.js b/sense/app/kb/api_1_0/query.js index 62441db71ed2a..463cacb802a8f 100644 --- a/sense/app/kb/api_1_0/query.js +++ b/sense/app/kb/api_1_0/query.js @@ -150,24 +150,6 @@ define(["_"], function (_) { type: '', values: [] }, - custom_score: { - __template: { - query: {}, - script: '' - }, - query: {}, - script: '', - params: {}, - lang: 'mvel' - }, - custom_boost_factor: { - __template: { - query: {}, - boost_factor: 1.1 - }, - query: {}, - boost_factor: 1.1 - }, constant_score: { __template: { filter: {}, @@ -572,4 +554,4 @@ define(["_"], function (_) { }); }; -}); \ No newline at end of file +});