JsonParseException: Unexpected character (':' (code 58)): was expecting either valid name character (for unquoted name) or double-quote (for quoted) to start field name
我的映射结构
{
"patientinfo": {
"properties": {
"address": {
"type": "nested",
"properties": {
"patient_current_address": {
"type": "string"
},
"patient_old_address": {
"type": "string"
},
"patient_origin_address": {
"type": "string"
}
}
}
}
}
}
构建批量请求的代码如下所示:
BulkRequestBuilder bulkRequest = client.prepareBulk();
XContentBuilder xb = XContentFactory.jsonBuilder().startObject();
xb.startObject();
xb.field("globalId","196ad302157add3ad63cd1154e968dfa");
xb.field("date_of_birth", new Date());
xb.field("last_name","trying out Rehman");
xb.field("id", "7");
xb.field("first_name", "Anees");
xb.startArray("address");
xb.startObject();
xb.field("patient_origin_address","origin");
xb.field("patient_current_address","current");
xb.field("patient_old_address", "old");
xb.endObject();
xb.endArray();
xb.endObject();
bulkRequest
.add(client
.prepareIndex(INDEX_NAME, INDEX_TYPE, "1")
.setSource(xb));
答案 0 :(得分:0)
我的另一个问题是我们如何处理日期字段:
QueryBuilder qbQuery= fuzzyLikeThisQuery("first_name","last_name","date_of_birth")
.likeText("anis")
.likeText("shahver")
.likeText("1985-05-15")
more_like_this不支持二进制/数字字段:[date_of_birth]]