我正在使用TermVectorsRequestBuilder通过弹性搜索6.2.3和spring-boot 2.0.3获取特定关键字的结果。
以下是代码:-
TermVectorsRequestBuilder requestBuilder;
requestBuilder = client.prepareTermVectors().setIndex("index1").setType("type1").setTermStatistics(true).setFieldStatistics(false);
TermVectorsResponse response;
try {
response = requestBuilder.execute().actionGet();
} catch (NoNodeAvailableException e) {
throw e;
}
try {
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON).prettyPrint();
builder.startObject();
response.toXContent(builder, ToXContent.EMPTY_PARAMS);
执行代码时出现错误:-
Can not start an object, expecting field name (context: Object)
请提出如何解决该错误的建议。