Hi All ,
We are new to ES and trying very small search functionality through mustache template.We have created a index in local ES and inserted one sample record.
We created a mustache template -
{"query":{"template":{"inline":{"bool":{"must":[
{{#nameFilter}}
{"bool" : {"should" : { "match" : { "{{fieldName}}" : "{{fieldValue}}" } }}}
{{#FC}},{{/FC}}
{{/nameFilter}}
}}}}}
My postman url -
http://localhost:9200/patientsummaryindex_test/dvaPatientDoc/_search/template
Below is my query which I am sending in body
{
"file":"LatestTemplate",
"params":{
"namefilter":[
{
"fieldName":"name",
"fieldValue":"Amol"
}
]
}
}
What we get is -
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[script] failed to parse field [inline]",
"line": 4,
"col": 1
}
],
"type": "parsing_exception",
"reason": "[script] failed to parse field [inline]",
"line": 4,
"col": 1,
"caused_by": {
"type": "unchecked_i_o_exception",
"reason": "com.fasterxml.jackson.core.JsonParseException: Unexpected close marker '}': expected ']' (for Array starting at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@4b92c3c9; line: 1, column: 48])\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@4b92c3c9; line: 4, column: 2]",
"caused_by": {
"type": "json_parse_exception",
"reason": "Unexpected close marker '}': expected ']' (for Array starting at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@4b92c3c9; line: 1, column: 48])\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@4b92c3c9; line: 4, column: 2]"
}
}
},
"status": 400
}
We tried filter on many fields but the error is more or less same.The query json is correct as when we validate it.
Can someone find whats wrong here ?