ElasticSearch ClassCastException - 映射元数据到映射元数据
ElasticSearch ClassCastException - MappingMetadata to MappingMetadata
我需要你的帮助。我不知道这里出了什么问题。
当我启动我的 JavaApp 以从 ElasticSearch 获取数据时,我得到了这个 ClassCastException:
ElasticDBPersistanceImp | findQueryField failed for templateId
java.lang.ClassCastException: org.elasticsearch.cluster.metadata.MappingMetadata cannot be cast to org.elasticsearch.cluster.metadata.MappingMetaData
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getAllFields(ElasticDBPersistanceImpl.java:251) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.findQueryField(ElasticDBPersistanceImpl.java:226) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getFieldDataDistict(ElasticDBPersistanceImpl.java:163) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.getTemplateIds(FormListSecurityServiceImpl.java:40) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.<init>(FormListSecurityServiceImpl.java:21) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.HformsFormlistFactoryImpl.<init>(HformsFormlistFactoryImpl.java:55) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.startTenant(Booter.java:70) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.lambda[=10=](Booter.java:45) ~[classes/:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
我正在使用的代码在此处的文档中提供https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-get-mappings.html
稍微修改一下,它看起来像:
GetMappingsResponse mapping1 = dbManager.getFormlistDBConnection().indices().getMapping(getMappingsRequest, RequestOptions.DEFAULT);
Map<String, MappingMetaData> mappings2 = mapping1.mappings();
MappingMetaData mappingMetaData = mappings2.get(indexName);
Map<String, Object> sourceAsMap = mappingMetaData.getSourceAsMap();
所以也许你们中有人知道这里出了什么问题?
提前致谢
经过数小时的搜索,似乎是 maven 的问题。
删除我的本地 Maven 存储库后重新加载源它现在似乎可以工作了。
我需要你的帮助。我不知道这里出了什么问题。
当我启动我的 JavaApp 以从 ElasticSearch 获取数据时,我得到了这个 ClassCastException:
ElasticDBPersistanceImp | findQueryField failed for templateId
java.lang.ClassCastException: org.elasticsearch.cluster.metadata.MappingMetadata cannot be cast to org.elasticsearch.cluster.metadata.MappingMetaData
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getAllFields(ElasticDBPersistanceImpl.java:251) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.findQueryField(ElasticDBPersistanceImpl.java:226) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.persistance.impl.elastic.ElasticDBPersistanceImpl.getFieldDataDistict(ElasticDBPersistanceImpl.java:163) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.getTemplateIds(FormListSecurityServiceImpl.java:40) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.FormListSecurityServiceImpl.<init>(FormListSecurityServiceImpl.java:21) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.HformsFormlistFactoryImpl.<init>(HformsFormlistFactoryImpl.java:55) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.startTenant(Booter.java:70) ~[classes/:?]
at com.initka.bprocess.hforms_formlist.startup.Booter.lambda[=10=](Booter.java:45) ~[classes/:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_222]
我正在使用的代码在此处的文档中提供https://www.elastic.co/guide/en/elasticsearch/client/java-rest/master/java-rest-high-get-mappings.html
稍微修改一下,它看起来像:
GetMappingsResponse mapping1 = dbManager.getFormlistDBConnection().indices().getMapping(getMappingsRequest, RequestOptions.DEFAULT);
Map<String, MappingMetaData> mappings2 = mapping1.mappings();
MappingMetaData mappingMetaData = mappings2.get(indexName);
Map<String, Object> sourceAsMap = mappingMetaData.getSourceAsMap();
所以也许你们中有人知道这里出了什么问题?
提前致谢
经过数小时的搜索,似乎是 maven 的问题。
删除我的本地 Maven 存储库后重新加载源它现在似乎可以工作了。