Return the Version of Elasticsearch that has been used to create an index given its settings. @throws IllegalStateException if the given index settings doesn't contain a value for the key IndexMetadata#SETTING_VERSION_CREATED
(Settings indexSettings)
| 348 | * {@value IndexMetadata#SETTING_VERSION_CREATED} |
| 349 | */ |
| 350 | public static Version indexCreated(Settings indexSettings) { |
| 351 | final Version indexVersion = IndexMetadata.SETTING_INDEX_VERSION_CREATED.get(indexSettings); |
| 352 | if (indexVersion == V_EMPTY) { |
| 353 | final String message = String.format( |
| 354 | Locale.ROOT, |
| 355 | "[%s] is not present in the index settings for index with UUID [%s]", |
| 356 | IndexMetadata.SETTING_INDEX_VERSION_CREATED.getKey(), |
| 357 | indexSettings.get(IndexMetadata.SETTING_INDEX_UUID)); |
| 358 | throw new IllegalStateException(message); |
| 359 | } |
| 360 | return indexVersion; |
| 361 | } |
| 362 | |
| 363 | public static void writeVersion(Version version, StreamOutput out) throws IOException { |
| 364 | out.writeVInt(version.internalId); |
no test coverage detected