From a84498f6b6a1377b6fe53617abf016e7910762a6 Mon Sep 17 00:00:00 2001 From: StephaneBour Date: Mon, 15 Jan 2024 12:04:20 +0100 Subject: [PATCH] style(kb): remove unnecessary whitespace in JS files --- kb/aggs.js | 1 - kb/aliases.js | 60 +++--- kb/cluster.js | 26 +-- kb/facets.js | 168 ++++++++-------- kb/filter.js | 496 ++++++++++++++++++++++++------------------------ kb/globals.js | 22 +-- kb/indices.js | 66 +++---- kb/mappings.js | 166 ++++++++-------- kb/misc.js | 30 +-- kb/query.js | 3 +- kb/search.js | 165 ++++++++-------- kb/settings.js | 80 ++++---- kb/templates.js | 30 +-- kb/warmers.js | 34 ++-- 14 files changed, 675 insertions(+), 672 deletions(-) diff --git a/kb/aggs.js b/kb/aggs.js index 4ca6e13..c310f24 100755 --- a/kb/aggs.js +++ b/kb/aggs.js @@ -1,5 +1,4 @@ sense.kb.addGlobalAutocompleteRules("aggregations", { - // Metrics Aggregations avg: { __template: {field: ""}, diff --git a/kb/aliases.js b/kb/aliases.js index e986bc3..53c06df 100755 --- a/kb/aliases.js +++ b/kb/aliases.js @@ -1,34 +1,34 @@ sense.kb.addEndpointDescription('_aliases', { - match: /_aliases/, - def_method: "GET", - methods: ["GET", "POST"], - endpoint_autocomplete: [ - "_aliases" - ], - indices_mode: "multi", - types_mode: "none", - doc_id_mode: "none", - data_autocomplete_rules: { - "actions": { - __template: [ - { "add": { "index": "test1", "alias": "alias1" } } - ], - __any_of: [ - { - add: { - index: "$INDEX$", - alias: "", - filter: {}, - routing: "1", - search_routing: "1,2", - index_routing: "1" - }, - remove: { - index: "", - alias: "" - } + match: /_aliases/, + def_method: "GET", + methods: ["GET", "POST"], + endpoint_autocomplete: [ + "_aliases" + ], + indices_mode: "multi", + types_mode: "none", + doc_id_mode: "none", + data_autocomplete_rules: { + "actions": { + __template: [ + {"add": {"index": "test1", "alias": "alias1"}} + ], + __any_of: [ + { + add: { + index: "$INDEX$", + alias: "", + filter: {}, + routing: "1", + search_routing: "1,2", + index_routing: "1" + }, + remove: { + index: "", + alias: "" + } + } + ] } - ] } - } }); \ No newline at end of file diff --git a/kb/cluster.js b/kb/cluster.js index a58d978..718c028 100755 --- a/kb/cluster.js +++ b/kb/cluster.js @@ -1,20 +1,20 @@ sense.kb.addEndpointDescription('_cluster/nodes/stats', { - methods: ["GET"], - indices_mode: "none", - types_mode: "none" + methods: ["GET"], + indices_mode: "none", + types_mode: "none" }); sense.kb.addEndpointDescription('_cluster/state', { - methods: ["GET"], - endpoint_autocomplete: ['_cluster/state'], - indices_mode: "none", - types_mode: "none" + methods: ["GET"], + endpoint_autocomplete: ['_cluster/state'], + indices_mode: "none", + types_mode: "none" }); sense.kb.addEndpointDescription('_cluster/health', { - methods: ["GET"], - endpoint_autocomplete: ['_cluster/health'], - indices_mode: "none", - types_mode: "none" + methods: ["GET"], + endpoint_autocomplete: ['_cluster/health'], + indices_mode: "none", + types_mode: "none" }); sense.kb.addEndpointDescription('_cluster/settings', { @@ -22,9 +22,9 @@ sense.kb.addEndpointDescription('_cluster/settings', { endpoint_autocomplete: ['_cluster/settings'], indices_mode: "none", types_mode: "none", - data_autocomplete_rules: { + data_autocomplete_rules: { persistent: { - "routing.allocation.same_shard.host" : { __one_of: [ false, true ]} + "routing.allocation.same_shard.host": {__one_of: [false, true]} }, transient: { diff --git a/kb/facets.js b/kb/facets.js index db1d93a..eacd481 100755 --- a/kb/facets.js +++ b/kb/facets.js @@ -1,92 +1,92 @@ sense.kb.addGlobalAutocompleteRules("facets", { - "*": { - terms: { - __template: { - field: "FIELD", - size: 10 + "*": { + terms: { + __template: { + field: "FIELD", + size: 10 + }, + field: "$FIELD$", + fields: ["$FIELD$"], + size: 10, + script: "", + script_field: "", + order: {__one_of: ["count", "term", "reverse_count", "reverse_term"]}, + all_terms: {__one_of: [false, true]}, + exclude: ["TERM"], + regex: "", + regex_flags: "" }, - field: "$FIELD$", - fields: ["$FIELD$"], - size: 10, - script: "", - script_field: "", - order: { __one_of: ["count", "term", "reverse_count", "reverse_term"]}, - all_terms: { __one_of: [false, true]}, - exclude: ["TERM"], - regex: "", - regex_flags: "" - }, - range: { - __template: { - field: "FIELD", - ranges: [ - { "to": 50 }, - { "from": 20, "to": 70 }, - { "from": 70, "to": 120 }, - { "from": 150 } - ] + range: { + __template: { + field: "FIELD", + ranges: [ + {"to": 50}, + {"from": 20, "to": 70}, + {"from": 70, "to": 120}, + {"from": 150} + ] + }, + field: "$FIELD$", + ranges: [ + {to: 10, from: 20} + ] }, - field: "$FIELD$", - ranges: [ - { to: 10, from: 20} - ] - }, - histogram: { - __template: { - field: "FIELD", interval: 100 + histogram: { + __template: { + field: "FIELD", interval: 100 + }, + field: "$FIELD$", + interval: 100, + time_interval: "1.5h", + key_field: "$FIELD$", + value_field: "$FIELD$", + key_script: "", + value_script: "", + params: {} }, - field: "$FIELD$", - interval: 100, - time_interval: "1.5h", - key_field: "$FIELD$", - value_field: "$FIELD$", - key_script: "", - value_script: "", - params: {} - }, - date_histogram: { - __template: { - field: "FIELD", - "interval": "day" + date_histogram: { + __template: { + field: "FIELD", + "interval": "day" + }, + field: "$FIELD$", + interval: {__one_of: ["year", "quarter", "month", "week", "day", "hour", "minute", "1h", "1d", "1w"]}, + post_zone: -1, + pre_zone: -1, + factor: 1000, + pre_offset: "1d", + post_offset: "1d", + key_field: "$FIELD$", + value_field: "$FIELD$", + value_script: "" }, - field: "$FIELD$", - interval: { __one_of: ["year", "quarter", "month", "week", "day", "hour", "minute", "1h", "1d", "1w"]}, - post_zone: -1, - pre_zone: -1, - factor: 1000, - pre_offset: "1d", - post_offset: "1d", - key_field: "$FIELD$", - value_field: "$FIELD$", - value_script: "" - }, - filter: { - }, - query: { - }, - facet_filter: { - __scope_link: "GLOBAL.filter" - }, - statistical: { - __template: { - field: "FIELD" + filter: {}, + query: {}, + facet_filter: { + __scope_link: "GLOBAL.filter" }, - field: "$FIELD$", - fields: ["$FIELD$"], - script: "" - }, - terms_stats: { - __template: { - key_field: "FIELD", - value_field: "FIELD" + statistical: { + __template: { + field: "FIELD" + }, + field: "$FIELD$", + fields: ["$FIELD$"], + script: "" }, - key_field: "$FIELD$", - value_field: "$FIELD$", - value_script: "", - size: 10, - order: {__one_of: ["count", "term", "reverse_term", "reverse_count", "total", "reverse_total", - "min", "reverse_min", "max", "reverse_max", "mean", "reverse_mean"]} - } - } - } + terms_stats: { + __template: { + key_field: "FIELD", + value_field: "FIELD" + }, + key_field: "$FIELD$", + value_field: "$FIELD$", + value_script: "", + size: 10, + order: { + __one_of: ["count", "term", "reverse_term", "reverse_count", "total", "reverse_total", + "min", "reverse_min", "max", "reverse_max", "mean", "reverse_mean"] + } + } + } + } ); diff --git a/kb/filter.js b/kb/filter.js index 0bc2480..5158c04 100755 --- a/kb/filter.js +++ b/kb/filter.js @@ -1,255 +1,255 @@ sense.kb.addGlobalAutocompleteRules("filter", { - and: { - __template: { - filters: [ - {} - ] - }, - filters: [ - { __scope_link: ".filter" } - ], - _cache: {__one_of: [ false, true ]} - }, - bool: { - must: [ - { __scope_link: ".filter"} - ], - must_not: [ - { __scope_link: ".filter"} - ], - should: [ - { __scope_link: ".filter"} - ], - _cache: {__one_of: [ false, true ]} - }, - exists: { - __template: { "FIELD": "VALUE"}, - "$FIELD$": "" - }, - ids: { - __template: { "values": ["ID"] }, - "type": "$TYPE$", - "values": [""] - }, - limit: { - __template: { value: 100}, - value: 100 - }, - type: { - __template: { value: "TYPE"}, - value: "$TYPE$" - }, - geo_bounding_box: { - __template: { - "FIELD": { - "top_left": { - "lat": 40.73, - "lon": -74.1 - }, - "bottom_right": { - "lat": 40.717, - "lon": -73.99 - } - } - }, + and: { + __template: { + filters: [ + {} + ] + }, + filters: [ + {__scope_link: ".filter"} + ], + _cache: {__one_of: [false, true]} + }, + bool: { + must: [ + {__scope_link: ".filter"} + ], + must_not: [ + {__scope_link: ".filter"} + ], + should: [ + {__scope_link: ".filter"} + ], + _cache: {__one_of: [false, true]} + }, + exists: { + __template: {"FIELD": "VALUE"}, + "$FIELD$": "" + }, + ids: { + __template: {"values": ["ID"]}, + "type": "$TYPE$", + "values": [""] + }, + limit: { + __template: {value: 100}, + value: 100 + }, + type: { + __template: {value: "TYPE"}, + value: "$TYPE$" + }, + geo_bounding_box: { + __template: { + "FIELD": { + "top_left": { + "lat": 40.73, + "lon": -74.1 + }, + "bottom_right": { + "lat": 40.717, + "lon": -73.99 + } + } + }, - "$FIELD$": { - top_left: { lat: 40.73, lon: -74.1 }, - bottom_right: { lat: 40.73, lon: -74.1 } - }, - type: { __one_of: ["memory", "indexed"]}, - _cache: {__one_of: [ false, true ]} - }, - geo_distance: { - __template: { - distance: 100, - distance_unit: "km", - "FIELD": { lat: 40.73, lon: -74.1 } - }, - distance: 100, - distance_unit: { __one_of: [ "km", "miles"]}, - distance_type: { __one_of: [ "arc", "plane"]}, - optimize_bbox: { __one_of: [ "memory", "indexed", "none"]}, - "$FIELD$": { lat: 40.73, lon: -74.1 }, - _cache: {__one_of: [ false, true ]} - }, - geo_distance_range: { - __template: { - from: 100, - to: 200, - distance_unit: "km", - "FIELD": { lat: 40.73, lon: -74.1 } - }, - from: 100, - to: 200, + "$FIELD$": { + top_left: {lat: 40.73, lon: -74.1}, + bottom_right: {lat: 40.73, lon: -74.1} + }, + type: {__one_of: ["memory", "indexed"]}, + _cache: {__one_of: [false, true]} + }, + geo_distance: { + __template: { + distance: 100, + distance_unit: "km", + "FIELD": {lat: 40.73, lon: -74.1} + }, + distance: 100, + distance_unit: {__one_of: ["km", "miles"]}, + distance_type: {__one_of: ["arc", "plane"]}, + optimize_bbox: {__one_of: ["memory", "indexed", "none"]}, + "$FIELD$": {lat: 40.73, lon: -74.1}, + _cache: {__one_of: [false, true]} + }, + geo_distance_range: { + __template: { + from: 100, + to: 200, + distance_unit: "km", + "FIELD": {lat: 40.73, lon: -74.1} + }, + from: 100, + to: 200, - distance_unit: { __one_of: [ "km", "miles"]}, - distance_type: { __one_of: [ "arc", "plane"]}, - include_lower: { __one_of: [ true, false]}, - include_upper: { __one_of: [ true, false]}, + distance_unit: {__one_of: ["km", "miles"]}, + distance_type: {__one_of: ["arc", "plane"]}, + include_lower: {__one_of: [true, false]}, + include_upper: {__one_of: [true, false]}, - "$FIELD$": { lat: 40.73, lon: -74.1 }, - _cache: {__one_of: [ false, true ]} - }, - geo_polygon: { - __template: { - "FIELD": { - "points": [ - { lat: 40.73, lon: -74.1 }, - { lat: 40.83, lon: -75.1 } - ] - } - }, - "$FIELD$": { - points: [ - { lat: 40.73, lon: -74.1 } - ] - }, - _cache: {__one_of: [ false, true ]} - }, - geo_shape: { - __template: { - "FIELD": { - shape: { - type: "envelope", - coordinates: [ - [-45, 45], - [45, -45] - ] - }, - "relation": "within" - } - }, - "$FIELD$": { - shape: { - type: "", - coordinates: [] - }, - indexed_shape: { - id: "", - index: "$INDEX$", + "$FIELD$": {lat: 40.73, lon: -74.1}, + _cache: {__one_of: [false, true]} + }, + geo_polygon: { + __template: { + "FIELD": { + "points": [ + {lat: 40.73, lon: -74.1}, + {lat: 40.83, lon: -75.1} + ] + } + }, + "$FIELD$": { + points: [ + {lat: 40.73, lon: -74.1} + ] + }, + _cache: {__one_of: [false, true]} + }, + geo_shape: { + __template: { + "FIELD": { + shape: { + type: "envelope", + coordinates: [ + [-45, 45], + [45, -45] + ] + }, + "relation": "within" + } + }, + "$FIELD$": { + shape: { + type: "", + coordinates: [] + }, + indexed_shape: { + id: "", + index: "$INDEX$", + type: "$TYPE$", + shape_field_name: "shape" + }, + relation: {__one_of: ["within", "intersects", "disjoint"]} + } + }, + has_child: { + __template: { + type: "TYPE", + query: {} + }, type: "$TYPE$", - shape_field_name: "shape" - }, - relation: { __one_of: ["within", "intersects", "disjoint"]} + query: {}, + _scope: "" + }, + has_parent: { + __template: { + type: "TYPE", + query: {} + }, + type: "$TYPE$", + query: {}, + _scope: "" + }, + match_all: {}, + missing: { + __template: { + field: "FIELD" + }, + existence: {__one_of: [true, false]}, + null_value: {__one_of: [true, false]}, + field: "$FIELD$" + }, + not: { + __template: { + filter: {} + }, + filter: {__scope_link: ".filter"}, + _cache: {__one_of: [true, false]} + }, + numeric_range: { + __template: { + "FIELD": { + from: 10, + to: 20 + } + }, + from: 1, + to: 20, + include_lower: {__one_of: [true, false]}, + include_upper: {__one_of: [true, false]} + }, + or: { + __template: { + filters: [ + {} + ] + }, + filters: [ + {__scope_link: ".filter"} + ], + _cache: {__one_of: [false, true]} + }, + prefix: { + __template: { + "FIELD": "VALUE" + }, + "$FIELD$": "", + _cache: {__one_of: [true, false]} + }, + query: {__scope_link: ".query"}, + fquery: { + __template: { + query: {}, + _cache: true + }, + query: {__scope_link: ".query"}, + _cache: {__one_of: [true, false]} + }, + range: { + __template: { + "FIELD": { + from: 10, + to: 20 + } + }, + from: 1, + to: 20, + include_lower: {__one_of: [true, false]}, + include_upper: {__one_of: [true, false]}, + _cache: {__one_of: [false, true]} + }, + script: { + __template: { + script: "SCRIPT", + params: {} + }, + script: "", + params: {}, + _cache: {__one_of: [true, false]} + }, + term: { + __template: { + "FIELD": "VALUE" + }, + "$FIELD$": "", + _cache: {__one_of: [false, true]} + }, + terms: { + __template: {"FIELD": ["VALUE1", "VALUE2"]}, + field: ["$FIELD$"], + execution: {__one_of: ["plain", "bool", "and", "or", "bool_nocache", "and_nocache", "or_nocache"]}, + _cache: {__one_of: [false, true]} + }, + nested: { + __template: { + path: "path_to_nested_doc", + query: {} + }, + query: {}, + path: "", + _cache: {__one_of: [true, false]}, + _name: "" } - }, - has_child: { - __template: { - type: "TYPE", - query: {} - }, - type: "$TYPE$", - query: {}, - _scope: "" - }, - has_parent: { - __template: { - type: "TYPE", - query: {} - }, - type: "$TYPE$", - query: {}, - _scope: "" - }, - match_all: { }, - missing: { - __template: { - field: "FIELD" - }, - existence: { __one_of: [ true, false]}, - null_value: { __one_of: [ true, false]}, - field: "$FIELD$" - }, - not: { - __template: { - filter: {} - }, - filter: { __scope_link: ".filter"}, - _cache: { __one_of: [ true, false]} - }, - numeric_range: { - __template: { - "FIELD": { - from: 10, - to: 20 - } - }, - from: 1, - to: 20, - include_lower: { __one_of: [ true, false]}, - include_upper: { __one_of: [ true, false]} - }, - or: { - __template: { - filters: [ - {} - ] - }, - filters: [ - { __scope_link: ".filter" } - ], - _cache: {__one_of: [ false, true ]} - }, - prefix: { - __template: { - "FIELD": "VALUE" - }, - "$FIELD$": "", - _cache: { __one_of: [ true, false]} - }, - query: { __scope_link: ".query"}, - fquery: { - __template: { - query: {}, - _cache: true - }, - query: { __scope_link: ".query"}, - _cache: { __one_of: [ true, false]} - }, - range: { - __template: { - "FIELD": { - from: 10, - to: 20 - } - }, - from: 1, - to: 20, - include_lower: { __one_of: [ true, false]}, - include_upper: { __one_of: [ true, false]}, - _cache: { __one_of: [ false, true ]} - }, - script: { - __template: { - script: "SCRIPT", - params: {} - }, - script: "", - params: {}, - _cache: { __one_of: [ true, false]} - }, - term: { - __template: { - "FIELD": "VALUE" - }, - "$FIELD$": "", - _cache: { __one_of: [ false, true]} - }, - terms: { - __template: { "FIELD": ["VALUE1", "VALUE2"]}, - field: [ "$FIELD$"], - execution: { __one_of: [ "plain", "bool", "and", "or", "bool_nocache", "and_nocache", "or_nocache"]}, - _cache: { __one_of: [ false, true ]} - }, - nested: { - __template: { - path: "path_to_nested_doc", - query: {} - }, - query: {}, - path: "", - _cache: { __one_of: [ true, false]}, - _name: "" - } }); diff --git a/kb/globals.js b/kb/globals.js index fb47c24..e16dfea 100755 --- a/kb/globals.js +++ b/kb/globals.js @@ -1,19 +1,19 @@ sense.kb.addGlobalAutocompleteRules("highlight", { - pre_tags: {}, post_tags: {}, tags_schema: {}, - fields: { "$FIELD$": { "fragment_size": {}, "number_of_fragments": {} }} + pre_tags: {}, post_tags: {}, tags_schema: {}, + fields: {"$FIELD$": {"fragment_size": {}, "number_of_fragments": {}}} } ); // only used with scope links as there is no common name for scripts sense.kb.addGlobalAutocompleteRules("SCRIPT_ENV", { - __template: { }, - script: "", - lang: "", - params: { - type_field: "", - promoted_field: "" - }, - id: "", - source: "" + __template: {}, + script: "", + lang: "", + params: { + type_field: "", + promoted_field: "" + }, + id: "", + source: "" } ); diff --git a/kb/indices.js b/kb/indices.js index e1d8716..34cbad5 100755 --- a/kb/indices.js +++ b/kb/indices.js @@ -1,44 +1,44 @@ sense.kb.addEndpointDescription('_refresh', { - def_method: "POST", - methods: ["POST"], - endpoint_autocomplete: [ - "_refresh" - ], - indices_mode: "multi" + def_method: "POST", + methods: ["POST"], + endpoint_autocomplete: [ + "_refresh" + ], + indices_mode: "multi" }); sense.kb.addEndpointDescription('_stats', { - def_method: "GET", - methods: ["GET"], - endpoint_autocomplete: [ - "_stats" - ], - indices_mode: "multi" + def_method: "GET", + methods: ["GET"], + endpoint_autocomplete: [ + "_stats" + ], + indices_mode: "multi" }); sense.kb.addEndpointDescription('_segments', { - def_method: "GET", - methods: ["GET"], - endpoint_autocomplete: [ - "_segments" - ], - indices_mode: "multi" + def_method: "GET", + methods: ["GET"], + endpoint_autocomplete: [ + "_segments" + ], + indices_mode: "multi" }); sense.kb.addEndpointDescription('__create_index__', { - methods: ["PUT", "DELETE"], - indices_mode: "single", - types_mode: "none", - match: "^/?$", - endpoint_autocomplete: [ - "" - ], - data_autocomplete_rules: { - mappings: { - __scope_link: "_mapping" - }, - settings: { - __scope_link: "_settings.index" - } - } + methods: ["PUT", "DELETE"], + indices_mode: "single", + types_mode: "none", + match: "^/?$", + endpoint_autocomplete: [ + "" + ], + data_autocomplete_rules: { + mappings: { + __scope_link: "_mapping" + }, + settings: { + __scope_link: "_settings.index" + } + } }); \ No newline at end of file diff --git a/kb/mappings.js b/kb/mappings.js index 4b4a137..746eae6 100755 --- a/kb/mappings.js +++ b/kb/mappings.js @@ -1,93 +1,97 @@ sense.kb.addEndpointDescription('_mapping', { - def_method: "GET", - methods: ["GET", "PUT"], - indices_mode: "multi", - types_mode: "multi", - data_autocomplete_rules: { - "$TYPE$": { - __template: { - properties: { - "FIELD": {} - } - }, - "_parent": { + def_method: "GET", + methods: ["GET", "PUT"], + indices_mode: "multi", + types_mode: "multi", + data_autocomplete_rules: { + "$TYPE$": { __template: { - "type": "" + properties: { + "FIELD": {} + } + }, + "_parent": { + __template: { + "type": "" + }, + "type": "$TYPE$" }, - "type": "$TYPE$" - }, - "index_analyzer": "standard", - "search_analyzer": "standard", - "analyzer": "standard", - "dynamic_date_formats": ["yyyy-MM-dd"], - "date_detection": { __one_of: [ true, false ]}, - "numeric_detection": { __one_of: [ true, false ]}, - "properties": { - "*": { - type: { __one_of: ["string", "float", "double", "byte", "short", "integer", "long", "date", "boolean", - "binary", "object", "nested", "multi_field"]}, + "index_analyzer": "standard", + "search_analyzer": "standard", + "analyzer": "standard", + "dynamic_date_formats": ["yyyy-MM-dd"], + "date_detection": {__one_of: [true, false]}, + "numeric_detection": {__one_of: [true, false]}, + "properties": { + "*": { + type: { + __one_of: ["string", "float", "double", "byte", "short", "integer", "long", "date", "boolean", + "binary", "object", "nested", "multi_field"] + }, - // strings - index_name: "", - store: { __one_of: ["no", "yes"]}, - index: { __one_of: ["analyzed", "not_analyzed", "no"]}, - term_vector: { __one_of: ["no", "yes", "with_offsets", "with_positions", "with_positions_offsets"]}, - boost: 1.0, - null_value: "", - omit_norms: { __one_of: [ true, false]}, - index_options: { __one_of: [ "docs", "freqs", "positions"]}, - analyzer: "standard", - index_analyzer: "standard", - search_analyzer: "standard", - include_in_all: { __one_of: [ false, true]}, - ignore_above: 10, - position_offset_gap: 0, + // strings + index_name: "", + store: {__one_of: ["no", "yes"]}, + index: {__one_of: ["analyzed", "not_analyzed", "no"]}, + term_vector: {__one_of: ["no", "yes", "with_offsets", "with_positions", "with_positions_offsets"]}, + boost: 1.0, + null_value: "", + omit_norms: {__one_of: [true, false]}, + index_options: {__one_of: ["docs", "freqs", "positions"]}, + analyzer: "standard", + index_analyzer: "standard", + search_analyzer: "standard", + include_in_all: {__one_of: [false, true]}, + ignore_above: 10, + position_offset_gap: 0, - // numeric - precision_step: 4, - ignore_malformed: { __one_of: [ true, false]}, + // numeric + precision_step: 4, + ignore_malformed: {__one_of: [true, false]}, - // dates - format: { __one_of: [ "basic_date", "basic_date_time", "basic_date_time_no_millis", - "basic_ordinal_date", "basic_ordinal_date_time", "basic_ordinal_date_time_no_millis", - "basic_time", "basic_time_no_millis", "basic_t_time", "basic_t_time_no_millis", - "basic_week_date", "basic_week_date_time", "basic_week_date_time_no_millis", - "date", "date_hour", "date_hour_minute", "date_hour_minute_second", "date_hour_minute_second_fraction", - "date_hour_minute_second_millis", "date_optional_time", "date_time", "date_time_no_millis", - "hour", "hour_minute", "hour_minute_second", "hour_minute_second_fraction", "hour_minute_second_millis", - "ordinal_date", "ordinal_date_time", "ordinal_date_time_no_millis", "time", "time_no_millis", - "t_time", "t_time_no_millis", "week_date", "week_date_time", "weekDateTimeNoMillis", "week_year", - "weekyearWeek", "weekyearWeekDay", "year", "year_month", "year_month_day"]}, + // dates + format: { + __one_of: ["basic_date", "basic_date_time", "basic_date_time_no_millis", + "basic_ordinal_date", "basic_ordinal_date_time", "basic_ordinal_date_time_no_millis", + "basic_time", "basic_time_no_millis", "basic_t_time", "basic_t_time_no_millis", + "basic_week_date", "basic_week_date_time", "basic_week_date_time_no_millis", + "date", "date_hour", "date_hour_minute", "date_hour_minute_second", "date_hour_minute_second_fraction", + "date_hour_minute_second_millis", "date_optional_time", "date_time", "date_time_no_millis", + "hour", "hour_minute", "hour_minute_second", "hour_minute_second_fraction", "hour_minute_second_millis", + "ordinal_date", "ordinal_date_time", "ordinal_date_time_no_millis", "time", "time_no_millis", + "t_time", "t_time_no_millis", "week_date", "week_date_time", "weekDateTimeNoMillis", "week_year", + "weekyearWeek", "weekyearWeekDay", "year", "year_month", "year_month_day"] + }, - fielddata: { - filter: { - regex: "", - frequency: { - min: 0.001, - max: 0.1, - min_segment_size: 500 - } - } - }, - postings_format: { __one_of: ["direct", "memory", "pulsing", "bloom_default", "bloom_pulsing", "default"]}, - similarity: { __one_of: [ "default", "BM25" ]}, + fielddata: { + filter: { + regex: "", + frequency: { + min: 0.001, + max: 0.1, + min_segment_size: 500 + } + } + }, + postings_format: {__one_of: ["direct", "memory", "pulsing", "bloom_default", "bloom_pulsing", "default"]}, + similarity: {__one_of: ["default", "BM25"]}, - // objects - properties: { - __scope_link: "_mapping.$TYPE$.properties" - }, + // objects + properties: { + __scope_link: "_mapping.$TYPE$.properties" + }, - // multi_field - path: { __one_of: [ "just_name", "full"]}, - fields: { - "*": { - __scope_link: "_mapping.$TYPE$.properties.$FIELD$" - } - } - } + // multi_field + path: {__one_of: ["just_name", "full"]}, + fields: { + "*": { + __scope_link: "_mapping.$TYPE$.properties.$FIELD$" + } + } + } - } - } - } + } + } + } }); diff --git a/kb/misc.js b/kb/misc.js index 6d24458..d9716b1 100755 --- a/kb/misc.js +++ b/kb/misc.js @@ -1,23 +1,23 @@ sense.kb.addEndpointDescription('_stats', { - methods: ["GET"], - endpoint_autocomplete: ['_stats'], - indices_mode: "multi", - types_mode: "none", - doc_id_mode: "none" + methods: ["GET"], + endpoint_autocomplete: ['_stats'], + indices_mode: "multi", + types_mode: "none", + doc_id_mode: "none" }); sense.kb.addEndpointDescription('_cache/clear', { - methods: ["GET"], - endpoint_autocomplete: ['_cache/clear'], - indices_mode: "multi", - types_mode: "none", - doc_id_mode: "none" + methods: ["GET"], + endpoint_autocomplete: ['_cache/clear'], + indices_mode: "multi", + types_mode: "none", + doc_id_mode: "none" }); sense.kb.addEndpointDescription('_status', { - methods: ["GET"], - indices_mode: "multi", - types_mode: "none", - doc_id_mode: "none", - endpoint_autocomplete: ['_status'] + methods: ["GET"], + indices_mode: "multi", + types_mode: "none", + doc_id_mode: "none", + endpoint_autocomplete: ['_status'] }); diff --git a/kb/query.js b/kb/query.js index 29652a2..bba0733 100755 --- a/kb/query.js +++ b/kb/query.js @@ -43,7 +43,7 @@ sense.kb.addGlobalAutocompleteRules("query", { fields: ["$FIELD$"], use_dis_max: {__template: true, __one_of: [true, false]}, tie_breaker: 0.0, - type: { __one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix'] } + type: {__one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix']} }, filter: { __template: {"FIELD": "TEXT"}, @@ -340,6 +340,7 @@ sense.kb.addGlobalAutocompleteRules("query", { path: "", query: {}, filter: {}, + _name: "", score_mode: {__one_of: ["avg", "total", "max", "none"]} }, custom_filters_score: { diff --git a/kb/search.js b/kb/search.js index 00abe92..994cc5c 100755 --- a/kb/search.js +++ b/kb/search.js @@ -1,88 +1,87 @@ sense.kb.addEndpointDescription('_search', { - def_method: "POST", - methods: ["GET", "POST"], - endpoint_autocomplete: [ - "_search" - ], - indices_mode: "multi", - types_mode: "multi", - doc_id_mode: "none", - data_autocomplete_rules: { - min_score: 0.5, - query: { - // populated by a global rule - }, - aggs: { - __template: { - "aggregation_name": { - } - }, - "*": { - __scope_link: "GLOBAL.aggregations" - } - }, - aggregations: { - __template: { - "aggregation_name": { - } - }, - "*": { - __scope_link: "GLOBAL.aggregations" - } - }, - facets: { - __template: { - "NAME": { - "TYPE": { - } + def_method: "POST", + methods: ["GET", "POST"], + endpoint_autocomplete: [ + "_search" + ], + indices_mode: "multi", + types_mode: "multi", + doc_id_mode: "none", + data_autocomplete_rules: { + min_score: 0.5, + query: { + // populated by a global rule + }, + aggs: { + __template: { + "aggregation_name": {} + }, + "*": { + __scope_link: "GLOBAL.aggregations" + } + }, + aggregations: { + __template: { + "aggregation_name": {} + }, + "*": { + __scope_link: "GLOBAL.aggregations" + } + }, + facets: { + __template: { + "NAME": { + "TYPE": {} + } } - } - // populated by a global rule - }, - filter: { - // added by global rules. - }, - size: { __template: 20 }, - from: {}, - _source: [ "$FIELD$" ], - sort: { - __template: [ - { "FIELD": { "order": "desc"} } - ], - __any_of: [ - { - "$FIELD$": { - "order": { __one_of: ["desc", "asc"]} - } + // populated by a global rule + }, + filter: { + // added by global rules. + }, + size: {__template: 20}, + from: {}, + _source: ["$FIELD$"], + sort: { + __template: [ + {"FIELD": {"order": "desc"}} + ], + __any_of: [ + { + "$FIELD$": { + "order": {__one_of: ["desc", "asc"]} + } + }, + "$FIELD$", + "_score" + ] + }, + search_type: {}, + fields: ["$FIELD$"], + script_fields: { + __template: { + "FIELD": { + "script": "" + } }, - "$FIELD$", - "_score" - ] - }, - search_type: {}, - fields: [ "$FIELD$" ], - script_fields: { - __template: { "FIELD": { - "script": "" - }}, - "*": { - __scope_link: "GLOBAL.SCRIPT_ENV" - } - }, - partial_fields: { - __template: { - "NAME": { include: [] } - }, - "*": { - include: [], - exclude: [] - } - }, - highlight: { - // populated by a global rule - }, - explain: { __one_of: [ true, false ]}, - stats: [ "" ] + "*": { + __scope_link: "GLOBAL.SCRIPT_ENV" + } + }, + partial_fields: { + __template: { + "NAME": {include: []} + }, + "*": { + include: [], + exclude: [] + } + }, + highlight: { + // populated by a global rule + }, + explain: {__one_of: [true, false]}, + stats: [""] - } + } }); \ No newline at end of file diff --git a/kb/settings.js b/kb/settings.js index e9ae182..26190df 100755 --- a/kb/settings.js +++ b/kb/settings.js @@ -1,45 +1,45 @@ sense.kb.addEndpointDescription('_settings', { - match: /_settings/, - methods: ["GET", "PUT"], - endpoint_autocomplete: ['_settings'], - indices_mode: "multi", - types_mode: "none", - doc_id_mode: "none", - data_autocomplete_rules: { - index: { - refresh_interval: "1s", - number_of_replicas: 1, - "blocks.read_only": { __one_of: [ false, true ]}, - "blocks.read": { __one_of: [ true, false ]}, - "blocks.write": { __one_of: [ true, false ]}, - "blocks.metadata": { __one_of: [ true, false] }, - term_index_interval: 32, - term_index_divisor: 1, - "translog.flush_threshold_ops": 5000, - "translog.flush_threshold_size": "200mb", - "translog.flush_threshold_period": "30m", - "translog.disable_flush": { __one_of: [ true, false ]}, - "cache.filter.max_size": "2gb", - "cache.filter.expire": "2h", - "gateway.snapshot_interval": "10s", - routing: { - allocation: { - include: { tag: "" }, - exclude: { tag: ""}, - require: { tag: ""}, - total_shards_per_node: -1 + match: /_settings/, + methods: ["GET", "PUT"], + endpoint_autocomplete: ['_settings'], + indices_mode: "multi", + types_mode: "none", + doc_id_mode: "none", + data_autocomplete_rules: { + index: { + refresh_interval: "1s", + number_of_replicas: 1, + "blocks.read_only": {__one_of: [false, true]}, + "blocks.read": {__one_of: [true, false]}, + "blocks.write": {__one_of: [true, false]}, + "blocks.metadata": {__one_of: [true, false]}, + term_index_interval: 32, + term_index_divisor: 1, + "translog.flush_threshold_ops": 5000, + "translog.flush_threshold_size": "200mb", + "translog.flush_threshold_period": "30m", + "translog.disable_flush": {__one_of: [true, false]}, + "cache.filter.max_size": "2gb", + "cache.filter.expire": "2h", + "gateway.snapshot_interval": "10s", + routing: { + allocation: { + include: {tag: ""}, + exclude: {tag: ""}, + require: {tag: ""}, + total_shards_per_node: -1 + } + }, + "recovery.initial_shards": {__one_of: ["quorum", "quorum-1", "half", "full", "full-1"]}, + "ttl.disable_purge": {__one_of: [true, false]}, + analysis: { + analyzer: {}, + tokenizer: {}, + filter: {}, + char_filter: {} } - }, - "recovery.initial_shards": { __one_of: ["quorum", "quorum-1", "half", "full", "full-1" ]}, - "ttl.disable_purge": { __one_of: [ true, false ]}, - analysis: { - analyzer: {}, - tokenizer: {}, - filter: {}, - char_filter: {} - } - } - } + } + } }); diff --git a/kb/templates.js b/kb/templates.js index 8b4893e..f16128f 100755 --- a/kb/templates.js +++ b/kb/templates.js @@ -1,18 +1,18 @@ sense.kb.addEndpointDescription('_template', { - match: /\/?_template/, - def_method: "PUT", - methods: ["GET", "PUT", "DELETE"], - endpoint_autocomplete: [ - "_template/TEMPLATE_ID" - ], - indices_mode: "none", - types_mode: "none", - doc_id_mode: "none", + match: /\/?_template/, + def_method: "PUT", + methods: ["GET", "PUT", "DELETE"], + endpoint_autocomplete: [ + "_template/TEMPLATE_ID" + ], + indices_mode: "none", + types_mode: "none", + doc_id_mode: "none", - data_autocomplete_rules: { - template: "index*", - warmers: { __scope_link: "_warmer" }, - mappings: {}, - settings: {} - } + data_autocomplete_rules: { + template: "index*", + warmers: {__scope_link: "_warmer"}, + mappings: {}, + settings: {} + } }); \ No newline at end of file diff --git a/kb/warmers.js b/kb/warmers.js index ce1cc7f..ad3e1a1 100755 --- a/kb/warmers.js +++ b/kb/warmers.js @@ -1,19 +1,19 @@ sense.kb.addEndpointDescription('_warmer', { - match: /_warmer/, - def_method: "PUT", - methods: ["GET", "PUT", "DELETE"], - endpoint_autocomplete: [ - "_warmer", "_warmer/WARMER_ID" - ], - indices_mode: "required_multi", - types_mode: "none", - doc_id_mode: "none", - data_autocomplete_rules: { - query: { - // populated by a global rule - }, - facets: { - // populated by a global rule - } - } + match: /_warmer/, + def_method: "PUT", + methods: ["GET", "PUT", "DELETE"], + endpoint_autocomplete: [ + "_warmer", "_warmer/WARMER_ID" + ], + indices_mode: "required_multi", + types_mode: "none", + doc_id_mode: "none", + data_autocomplete_rules: { + query: { + // populated by a global rule + }, + facets: { + // populated by a global rule + } + } }); \ No newline at end of file