forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ES Healthcheck v6 mapping compatibility (elastic#12714)
* Beginning to update the healthcheck to use the SavedObjectsClient Some tests are still broken The sort method on the SavedObjectsClient isn't there yet * Adding sort to create_find_query * Fixing the tests * Fixing upgrade_config tests * Making the SavedObjectsClient be dependant on the mappings to enable sorting * Fixing disabled tests * Fiixng test wording * Passing the savedObjectsClient to the stats route handler * Passing the savedObjectsClient to upgradeConfig from migratConfig * Using array of keys with _.get instead of manual string concatenation
- Loading branch information
Showing
15 changed files
with
236 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
import { get } from 'lodash'; | ||
import upgrade from './upgrade_config'; | ||
import { SavedObjectsClient } from '../../../server/saved_objects'; | ||
|
||
module.exports = function (server, { mappings }) { | ||
export default async function (server, { mappings }) { | ||
const config = server.config(); | ||
const { callWithInternalUser } = server.plugins.elasticsearch.getCluster('admin'); | ||
const options = { | ||
index: config.get('kibana.index'), | ||
|
||
const savedObjectsClient = new SavedObjectsClient(config.get('kibana.index'), mappings, callWithInternalUser); | ||
const { saved_objects: configSavedObjects } = await savedObjectsClient.find({ | ||
type: 'config', | ||
body: { | ||
size: 1000, | ||
sort: [ | ||
{ | ||
buildNum: { | ||
order: 'desc', | ||
unmapped_type: get(mappings, 'config.properties.buildNum.type') || 'keyword' | ||
} | ||
} | ||
] | ||
} | ||
}; | ||
page: 1, | ||
perPage: 1000, | ||
sortField: 'buildNum', | ||
sortOrder: 'desc' | ||
}); | ||
|
||
return callWithInternalUser('search', options).then(upgrade(server)); | ||
}; | ||
return await upgrade(server, savedObjectsClient)(configSavedObjects); | ||
} |
Oops, something went wrong.