AngularJS with elasticsearch - Query malformed , parsing exception

Hi All,

I am using elasticsearch with angularjs.

I have used this simple query and it is working in sense.

note : term is the value that I am passing at run time.

client.search({
"index": 'stocks',
"type": 'stock',
"body": {
"from" : 0, "size" : 20,
"query": {
"bool":{
"should":[
{
"match":{
"name": term
}
},
{
"match_phrase":{
"symbol": term
}
},
{
"match":{
"industry": term
}
}
]
}

    }
  }

})

But when I am running this in my program, I am getting this error

[query_parsing_exception] [match] query malformed, no field, with { index=stocks line=1 col=58 }

I also checked elasticsearch logs and I got below msg

nested: SearchParseException[failed to parse search source [{"from":0,"size":20,"query":{"bool":{"should":[{"match":{}},{"match_phrase":{}},{"match":{}}]}}}]]; nested: QueryParsingException[[match] query malformed, no field];

As per above message,there are no fields in the query.

Can you please tell me where I am going wrong.

Thanks for help,
J

Never used the javascript client, but are single quotes allowed in the JSON?

"index": 'stocks',
"type": 'stock',

Cannot figure out what else. It always something small that your eyes
cannot pick up!

Ivan