# Javascript API query failing

**URL:** <https://discuss.elastic.co/t/javascript-api-query-failing/58451>\
**Category:** Elasticsearch\
**Created:** [August 19, 2016, 11:57am UTC](https://discuss.elastic.co/t/javascript-api-query-failing/58451 "2016-08-19T11:57:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bghester](https://avatars.discourse-cdn.com/v4/letter/b/7ab992/32.png) [@bghester](https://discuss.elastic.co/u/bghester)\
**Post date:** [August 19, 2016, 11:57am UTC](https://discuss.elastic.co/t/javascript-api-query-failing/58451/1 "2016-08-19T11:57:45Z")

</div>

Hi All,

Newbie here and trying to use the javascript api to do a prefix search on all fields in the document. Running the prefix search using Sense works perfectly. From the js api I always get the first 10 docs in the index returned and when I examine the post url it ends with query=

Can someone point out to me what I'm doing wrong?

client.search({  
index: 'candidate\_quick',  
type: 'profile',  
query: {  
prefix: {  
\_all: {  
value: 'somevalue'  
}  
}  
}  
}, function (error, response) {  
if (error) console.error(error)  
else console.log(response);  
});

---

<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, 10:26pm UTC](https://discuss.elastic.co/t/javascript-api-query-failing/58451/2 "2017-07-05T22:26:35Z")

</div>


