I'm trying to do an Elasticsearch GET query with a very simple script using Postman. When the script is all on one line it works but if I try to do multiple lines I get an error
I'm sening the data as JSON with Content-Type: application/json in the header
Example - Works:
{
"query":{
"match_all": {}
},
"script_fields": {
"my_custom_field":{
"script": {
"lang": "painless",
"source": "int count = 1; return count;"
}
}
}
}
Example - Produces Error:
{
"query":{
"match_all": {}
},
"script_fields": {
"my_custom_field":{
"script": {
"lang": "painless",
"source": """
int count = 1;
return count;
"""
}
}
}
}
The error:
"Unexpected character ('\"' (code 34)): was expecting comma to separate Object entries\n at [Source: org.elasticsearch.transport.netty4.ByteBufStreamInput@20493763; line: 9, column: 18]"
I think postman may be adding line breaks in behind the scenes.