easy-es icon indicating copy to clipboard operation
easy-es copied to clipboard

SCALED_FLOAT类型报错,及BigDecimal类型的疑问

Open aquaqu-v246 opened this issue 2 years ago • 1 comments

java.util.concurrent.CompletionException: ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: Field [scaling_factor] is required]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Field [scaling_factor] is required]]; at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273) at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1606) at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157) Caused by: ElasticsearchStatusException[Elasticsearch exception [type=mapper_parsing_exception, reason=Failed to parse mapping [_doc]: Field [scaling_factor] is required]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Field [scaling_factor] is required]]; at org.elasticsearch.rest.BytesRestResponse.errorFromXContent(BytesRestResponse.java:176) at org.elasticsearch.client.RestHighLevelClient.parseEntity(RestHighLevelClient.java:2011) at org.elasticsearch.client.RestHighLevelClient.parseResponseException(RestHighLevelClient.java:1988) at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1745) at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1717) at org.elasticsearch.client.RestHighLevelClient.performRequestAndParseEntity(RestHighLevelClient.java:1684) at org.elasticsearch.client.IndicesClient.create(IndicesClient.java:134) at org.dromara.easyes.core.toolkit.IndexUtils.createIndex(IndexUtils.java:151) at org.dromara.easyes.starter.service.impl.AutoProcessIndexSmoothlyServiceImpl.doCreateIndex(AutoProcessIndexSmoothlyServiceImpl.java:131) at org.dromara.easyes.starter.service.impl.AutoProcessIndexSmoothlyServiceImpl.doUpdateIndex(AutoProcessIndexSmoothlyServiceImpl.java:76) at org.dromara.easyes.starter.service.impl.AutoProcessIndexSmoothlyServiceImpl.process(AutoProcessIndexSmoothlyServiceImpl.java:48) at org.dromara.easyes.core.toolkit.IndexUtils.lambda$supplyAsync$28(IndexUtils.java:746) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1604)

经翻阅代码在java中找到: // 设置type if (FieldType.KEYWORD_TEXT.getType().equals(indexParam.getFieldType())) { info.put(BaseEsConstants.TYPE, FieldType.TEXT.getType()); info.put(FIELDS_KEY, FIELDS_MAP); } else { info.put(BaseEsConstants.TYPE, indexParam.getFieldType()); } 除了TEXT类型外,没有对其它类型作特殊处理,而SCALED_FLOAT类型却必须要指定scaling_factor,但咱们的框架目前还没有这个功能.

另外,我看java的BigDecimal类型对应到了keyword,可是这样对于排序及比较非常不方便,是否可以将BigDecimal自动对应到SCALED_FLOAT类型呢?

我使用的是BETA2版本

aquaqu-v246 avatar May 08 '23 03:05 aquaqu-v246

此特性将在beta3支持 目前可以自建索引解决

xpc1024 avatar May 17 '23 12:05 xpc1024