ToXContent response=///////in debugger it shows:
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
////////
XContentBuilder builder=XContentFactory.contentBuilder(XContentType.JSON);
response.toXContent(builder, ToXContent.EMPTY_PARAMS);
The last line throws the exception:
org.elasticsearch.common.jackson.core.JsonGenerationException: Can notwrite a field name
, expecting a value
at org.elasticsearch.common.jackson.core.base.GeneratorBase._reportError(
GeneratorBase.java:424)
at org.elasticsearch.common.jackson.core.json.UTF8JsonGenerator.
writeFieldName(UTF8JsonGenerator.java:189)
at org.elasticsearch.common.xcontent.json.JsonXContentGenerator.
writeFieldName(JsonXContentGenerator.java:79)
at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.
java:239)
at org.elasticsearch.common.xcontent.XContentBuilder.field(XContentBuilder.
java:406)
at org.elasticsearch.action.search.SearchResponse.toXContent(SearchResponse
.java:249)
I'm not sure what could possibly be wrong here.
Could somebody help?
Thank you,
Eugene
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.