问题描述:
Caused by: jakarta.json.stream.JsonParsingException: Invalid token=CURLYCLOSE at (line no=1, column no=317, offset=316). Expected tokens are: [STRING]
问题分析:
1、使用json字符串创建索引时,字符串格式不对,多了一个逗号,导致报错。
String mapping="{ " +
"\"purchase_order_code\":{\"type\":\"keyword\"}," +
"\"type\":{\"type\":\"keyword\"}," +
"\"style\":{\"type\":\"keyword\"}," +
"\"color\":{\"type\":\"keyword\"}," +
"\"size\":{\"type\":\"keyword\"}," +
"\"total_pairs\":{\"type\":\"long\"}," +
"\"total_purchase_amount\":{\"type\":\"double\"}," +
"\"create_by_name\":{\"type\":\"keyword\"}," +
"\"create_time\":{\"type\":\"date\"}," +
"\"content\":{\"type\":\"keyword\"}," +
"}";
解决办法:去掉一个空格即可。