diff --git a/src/plugins/elasticsearch/lib/create_kibana_index.js b/src/plugins/elasticsearch/lib/create_kibana_index.js index d122ef4e3214c..b35e13fa84156 100644 --- a/src/plugins/elasticsearch/lib/create_kibana_index.js +++ b/src/plugins/elasticsearch/lib/create_kibana_index.js @@ -1,5 +1,7 @@ import SetupError from './setup_error'; import { format } from 'util'; +import { mappings } from './kibana_index_mappings'; + module.exports = function (server) { const client = server.plugins.elasticsearch.client; const index = server.config().get('kibana.index'); @@ -16,16 +18,7 @@ module.exports = function (server) { settings: { number_of_shards: 1 }, - mappings: { - config: { - properties: { - buildNum: { - type: 'string', - index: 'not_analyzed' - } - } - } - } + mappings } }) .catch(handleError('Unable to create Kibana index "<%= kibana.index %>"')) diff --git a/src/plugins/elasticsearch/lib/kibana_index_mappings.js b/src/plugins/elasticsearch/lib/kibana_index_mappings.js new file mode 100644 index 0000000000000..0d0204aeeecb5 --- /dev/null +++ b/src/plugins/elasticsearch/lib/kibana_index_mappings.js @@ -0,0 +1,10 @@ +export const mappings = { + config: { + properties: { + buildNum: { + type: 'string', + index: 'not_analyzed' + } + } + } +}; diff --git a/src/plugins/elasticsearch/lib/migrate_config.js b/src/plugins/elasticsearch/lib/migrate_config.js index 0eba1e0621717..7b16990e21297 100644 --- a/src/plugins/elasticsearch/lib/migrate_config.js +++ b/src/plugins/elasticsearch/lib/migrate_config.js @@ -1,4 +1,5 @@ import upgrade from './upgrade_config'; +import { mappings } from './kibana_index_mappings'; module.exports = function (server) { const config = server.config(); @@ -8,11 +9,16 @@ module.exports = function (server) { type: 'config', body: { size: 1000, - sort: [ { buildNum: { order: 'desc', ignore_unmapped: true } } ] + sort: [ + { + buildNum: { + order: 'desc', + unmapped_type: mappings.config.properties.buildNum.type + } + } + ] } }; return client.search(options).then(upgrade(server)); }; - -