reflect core change to method signature in sourceAsMap (elastic/x-pack-elasticsearch#1862)

x-pack change for https://github.com/elastic/elasticsearch/pull/25410

Original commit: elastic/x-pack-elasticsearch@908ddd3413
This commit is contained in:
Tal Levy 2017-06-27 08:59:29 -07:00 committed by GitHub
parent 403cf8eba3
commit 7c7bf475c1
4 changed files with 6 additions and 9 deletions

View File

@ -250,11 +250,7 @@ public class JobProvider {
Iterator<MappingMetaData> mappings = indexMetaData.getMappings().valuesIt();
while (mappings.hasNext()) {
MappingMetaData mapping = mappings.next();
try {
numFields += countFields(mapping.sourceAsMap());
} catch (IOException e) {
throw new RuntimeException(e);
}
numFields += countFields(mapping.sourceAsMap());
}
return numFields + additionalFieldCount > fieldCountLimit;
}

View File

@ -262,7 +262,7 @@ public class IndexLifecycleManager extends AbstractComponent {
throw new IllegalStateException("Cannot read security-version string in index " + indexName);
}
return Version.fromString((String) meta.get(SECURITY_VERSION_STRING));
} catch (IOException e) {
} catch (ElasticsearchParseException e) {
logger.error(new ParameterizedMessage(
"Cannot parse the mapping for index [{}]", indexName), e);
throw new ElasticsearchException(

View File

@ -6,6 +6,7 @@
package org.elasticsearch.license;
import org.apache.http.message.BasicHeader;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.Version;
import org.elasticsearch.action.DocWriteResponse;
@ -56,7 +57,6 @@ import org.elasticsearch.xpack.security.client.SecurityClient;
import org.elasticsearch.xpack.template.TemplateUtils;
import org.junit.Before;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
@ -304,7 +304,7 @@ public class LicensingTests extends SecurityIntegTestCase {
try {
Map<String, Object> meta = (Map<String, Object>) metaData.sourceAsMap().get("_meta");
return meta != null && expectedVersionAfterMigration.equals(meta.get(securityVersionField));
} catch (IOException e) {
} catch (ElasticsearchParseException e) {
return false;
}
}, 3, TimeUnit.SECONDS);

View File

@ -6,6 +6,7 @@
package org.elasticsearch.xpack.watcher.history;
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
import org.elasticsearch.cluster.metadata.MappingMetaData;
import org.elasticsearch.common.collect.ImmutableOpenMap;
@ -70,7 +71,7 @@ public class HistoryTemplateTimeMappingsTests extends AbstractWatcherIntegration
assertThat(extractValue("properties.trigger_event.properties.schedule.properties.scheduled_time.type", source),
is((Object) "date"));
assertThat(extractValue("properties.result.properties.execution_time.type", source), is((Object) "date"));
} catch (IOException e) {
} catch (ElasticsearchParseException e) {
throw new RuntimeException(e);
}
}