mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
fix: 修正索引添加
This commit is contained in:
@@ -142,8 +142,11 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
|
|||||||
JSONObject newField = new JSONObject();
|
JSONObject newField = new JSONObject();
|
||||||
newField.put(fieldName, fieldProperties);
|
newField.put(fieldName, fieldProperties);
|
||||||
|
|
||||||
|
JSONObject properties = new JSONObject();
|
||||||
|
properties.put("properties", newField);
|
||||||
|
|
||||||
PutMappingRequest request = new PutMappingRequest(CaseAiConstants.CASE_AI_INDEX_NAME);
|
PutMappingRequest request = new PutMappingRequest(CaseAiConstants.CASE_AI_INDEX_NAME);
|
||||||
request.source(newField.toJSONString(), XContentType.JSON);
|
request.source(properties.toJSONString(), XContentType.JSON);
|
||||||
try {
|
try {
|
||||||
AcknowledgedResponse response = elasticsearchClient.indices().putMapping(request, RequestOptions.DEFAULT);
|
AcknowledgedResponse response = elasticsearchClient.indices().putMapping(request, RequestOptions.DEFAULT);
|
||||||
if (response.isAcknowledged()) {
|
if (response.isAcknowledged()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user