fix: 修正索引添加

This commit is contained in:
liu.zixi
2025-12-04 18:50:52 +08:00
parent 68e610c222
commit e5cb156e64

View File

@@ -142,8 +142,11 @@ public class ElasticSearchIndexServiceImpl implements IElasticSearchIndexService
JSONObject newField = new JSONObject();
newField.put(fieldName, fieldProperties);
JSONObject properties = new JSONObject();
properties.put("properties", newField);
PutMappingRequest request = new PutMappingRequest(CaseAiConstants.CASE_AI_INDEX_NAME);
request.source(newField.toJSONString(), XContentType.JSON);
request.source(properties.toJSONString(), XContentType.JSON);
try {
AcknowledgedResponse response = elasticsearchClient.indices().putMapping(request, RequestOptions.DEFAULT);
if (response.isAcknowledged()) {