Elasticsearch JsonParsingException: Invalid token=CURLYCLOSE at.Expected tokens are: [STRING]问题解决

问题描述:

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\"}," +
                "}";

解决办法:去掉一个空格即可。

猜你喜欢

转载自blog.csdn.net/qq_38974638/article/details/131596714