I need to execute dynamic queries from Node JS . I tried the following script and getting error.
async function executeDynamicTest (){
const querySrting= "{index: 'entity_index', query: { match: { amount: '1819' }}}";
console.log(JSON.parse(JSON.stringify(querySrting))) ;
const document = await client.search({
body: JSON.parse(JSON.stringify(querySrting))
})
console.log(document.hits.hits);
}
The error I got is as mentioned below.
ResponseError: {"error":"Content-Type header [text/plain] is not supported","status":406}