JsonGenerationException for Boosting query

Hi Team,
I am using jest client to execute the execute the query.

Here is the ES query

GET visit.hippo_en/visit:PlaceDocument/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"title.value": {
"query": "automium bar",
"fuzziness":"AUTO",
"prefix_length":3,
"analyzer":"visit_hippo_analyser",
"boost": 5
}
}
},
{
"match": {
"_all": {
"query": "automium bar",
"fuzziness":"AUTO",
"prefix_length":3,
"analyzer":"visit_hippo_analyser"
}
}
}
],
"minimum_should_match": 1
}
}
}

Below is my json builder

XContentBuilder contentBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject("query")
.startObject("bool").field("minimum_should_match",1)
.startObject("should").field(
XContentFactory.jsonBuilder().startObject("match")
.startObject("title.value")
.field("query", text)
.field("fuzziness","AUTO")
.field("prefix_length", 3)
.field("analyzer","visit_hippo_analyser")
.field("boost",5)
.endObject()
.endObject().toString()).field(
XContentFactory.jsonBuilder().startObject("match")
.startObject("_all")
.field("query", text)
.field("fuzziness","AUTO")
.field("prefix_length", 3)
.field("analyzer","visit_hippo_analyser")
.endObject()
.endObject().toString())
.startObject()
.endObject()
.endObject()
.endObject();

Search search = new Search.Builder(contentBuilder.string())
.addIndex(visitHippoIndexName+"_"+lang).addType("visit:PlaceDocument")
.build();
try
{
io.searchbox.core.SearchResult result = jestClient.execute(search);
if (result.isSucceeded())
{
List<io.searchbox.core.SearchResult.Hit<SearchResultJson, Void>> hits =
result.getHits(SearchResultJson.class);
for (io.searchbox.core.SearchResult.Hit<SearchResultJson, Void> hit : hits)
{
results.add(SearchResult.fromSearchResultJson(hit.source));
System.out.println(hit.source.getTitle().getSource());
}
}
} catch (Exception e)
{
logger.error("Exception occurred for while executing Search query",
e.getMessage());
throw new Exception("System problem with do searching based on text");
}
return results;

But i am getting the exception
org.elasticsearch.common.jackson.JsonGenerationException: Can not write a
field name, expecting a value

*i am not to find the how to write having "should" syntax in java *

Please help me to provide the to build the JSON so that i can fire it
through jest client.Response will be appreciated!!!

Thanks

Nidhi

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3ba6a71e-70c1-4b02-b479-17a6617a60dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.