Skip to content

Commit

Permalink
Closes #206 - Additions to Sense Knowledge Base
Browse files Browse the repository at this point in the history
- Closes #169 - Add type field to multi_match
- Closes #175 - Adding global autocomplete rules for aliases
- Closes #194 - Adding time_zone to date_histogram agg
- Closes #199 - Removed multi_field type and added copy_to
- Closes #170 - Add _bunch endpoint
- Closes #174 - Adding _search/template endpoint
  • Loading branch information
simianhacker committed May 19, 2014
1 parent c731b14 commit 76cc5d6
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 15 deletions.
3 changes: 2 additions & 1 deletion sense/app/kb/api_1_0.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ define([
'./api',
'./api_1_0/aliases',
'./api_1_0/aggregations',
'./api_1_0/bench',
'./api_1_0/cat',
'./api_1_0/cluster',
'./api_1_0/document',
Expand Down Expand Up @@ -56,4 +57,4 @@ define([

return Api_1_0;

});
});
3 changes: 2 additions & 1 deletion sense/app/kb/api_1_0/aggregations.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ define(function () {
"factor": 1000,
"pre_offset": "1d",
"post_offset": "1d",
"format": "yyyy-MM-dd"
"format": "yyyy-MM-dd",
"time_zone": "00:00"
},
"geo_distance": {
__template: {
Expand Down
21 changes: 14 additions & 7 deletions sense/app/kb/api_1_0/aliases.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ define(function () {
"_aliases",
]
});

var aliasRules = {
filter: {},
routing: '1',
search_routing: '1,2',
index_routing: '1'
};

api.addEndpointDescription('_post_alias', {
methods: ["POST", "PUT"],
patterns: [
"{indices}/_alias/{name}"
],
data_autocomplete_rules: {
filter: {},
routing: '1',
search_routing: '1,2',
index_routing: '1'
}
data_autocomplete_rules: aliasRules
});
api.addEndpointDescription('_delete_alias', {
methods: ["DELETE"],
Expand All @@ -64,5 +67,9 @@ define(function () {
"_alias/{name}"
]
});

api.addGlobalAutocompleteRules('aliases', {
'*': aliasRules
});
};
});
});
46 changes: 46 additions & 0 deletions sense/app/kb/api_1_0/bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
define(function () {
'use strict';
return function init(api) {


api.addEndpointDescription('_put_bench', {
methods: ['PUT'],
patterns: ['_bench'],
data_autocomplete_rules: {
name: '',
percentiles: [],
num_executor_nodes: 1,
competitors: [{
__template: {
name: '',
requests: [{query:{}}]
},
name: '',
requests: [
{
__template: {
query: {}
},
query: {}
}
],
iterations: 5,
concurrency: 5,
multiplier: 1000,
warmup: { __one_of: [true, false] },
num_slowset: 1,
search_type: { __one_of: ['query_then_fetch', 'dfs_query_then_fetch', 'count'] },
clear_caches: {
filter: { __one_of: [true, false] },
field_data: { __one_of: [true, false] },
id: { __one_of: [true, false] },
recycler: { __one_of: [true, false] },
fields: ['{fields}'],
filter_keys: { __one_of: [true, false] }
},
indices: ['{indices}']
}]
}
});
};
});
9 changes: 8 additions & 1 deletion sense/app/kb/api_1_0/indices.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ define(function () {
},
settings: {
__scope_link: '_put_settings.index'
},
aliases: {
__template: {
"NAME": {

}
}
}
}
});
Expand All @@ -73,4 +80,4 @@ define(function () {
});
};

});
});
7 changes: 4 additions & 3 deletions sense/app/kb/api_1_0/mappings.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ define(function () {
'*': {
type: {
__one_of: ['string', 'float', 'double', 'byte', 'short', 'integer', 'long', 'date', 'boolean',
'binary', 'object', 'nested', 'multi_field'
'binary', 'object', 'nested'
]
},

Expand Down Expand Up @@ -138,7 +138,8 @@ define(function () {
'*': {
__scope_link: '_put_mapping.type.properties.field'
}
}
},
copy_to: { __one_of: ['{field}', ['{field}']] }
}
}
}
Expand All @@ -157,4 +158,4 @@ define(function () {
});
};

});
});
3 changes: 2 additions & 1 deletion sense/app/kb/api_1_0/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ define(["_"], function (_) {
__template: true,
__one_of: [true, false]
},
tie_breaker: 0.0
tie_breaker: 0.0,
type: { __one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix'] }
},
bool: {
must: [
Expand Down
20 changes: 19 additions & 1 deletion sense/app/kb/api_1_0/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ define(function () {

}
});

api.addEndpointDescription('_search_template', {
methods: ['GET'],
patterns: ['_search/template'],
data_autocomplete_rules: {
template: {
__template: {
"query": {}
}
},
query: {

},
params: {

}
}
});
};

});
});

0 comments on commit 76cc5d6

Please sign in to comment.