# AngularJS with elasticsearch - Query malformed , parsing exception

**URL:** <https://discuss.elastic.co/t/angularjs-with-elasticsearch-query-malformed-parsing-exception/41124>\
**Category:** Elasticsearch\
**Created:** [February 6, 2016, 7:31pm UTC](https://discuss.elastic.co/t/angularjs-with-elasticsearch-query-malformed-parsing-exception/41124 "2016-02-06T19:31:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jiteshanand](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@jiteshanand](https://discuss.elastic.co/u/jiteshanand)\
**Post date:** [February 6, 2016, 7:31pm UTC](https://discuss.elastic.co/t/angularjs-with-elasticsearch-query-malformed-parsing-exception/41124/1 "2016-02-06T19:31:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [February 9, 2016, 4:16am UTC](https://discuss.elastic.co/t/angularjs-with-elasticsearch-query-malformed-parsing-exception/41124/2 "2016-02-09T04:16:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 5, 2017, 11:18pm UTC](https://discuss.elastic.co/t/angularjs-with-elasticsearch-query-malformed-parsing-exception/41124/3 "2017-07-05T23:18:06Z")

</div>


