# I'm getting SearchParseException for constant\_score query with one term filter

**URL:** <https://discuss.elastic.co/t/im-getting-searchparseexception-for-constant-score-query-with-one-term-filter/4045>\
**Category:** Elasticsearch\
**Created:** [March 6, 2011, 2:28pm UTC](https://discuss.elastic.co/t/im-getting-searchparseexception-for-constant-score-query-with-one-term-filter/4045 "2011-03-06T14:28:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jae\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jae_lee/32/3258_2.png) [@Jae\_Lee](https://discuss.elastic.co/u/Jae_Lee)\
**Post date:** [March 6, 2011, 2:28pm UTC](https://discuss.elastic.co/t/im-getting-searchparseexception-for-constant-score-query-with-one-term-filter/4045/1 "2011-03-06T14:28:35Z")

</div>

Hi,

I'm getting a SearchParseException when I do

post 127.0.0.1:9200 /index/type/\_search?size=10  
{"constant\_score":{"filter":{"term":{"site":"fr"}}}}

Caused by: org.elasticsearch.search.SearchParseException: [index][4]:  
from[-1],size[-1]: Parse Failure [No parser for element [constant\_score]]

whereas if I do

post 127.0.0.1:9200 /index/type/\_search?size=10  
{"query":{"term":{"site":"fr"}}}

it's fine...

Am I doing something very simple very wrong?

J

---

<div class="post-metadata">

**Author:** ![Jae\_Lee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jae_lee/32/3258_2.png) [@Jae\_Lee](https://discuss.elastic.co/u/Jae_Lee)\
**Post date:** [March 6, 2011, 3:36pm UTC](https://discuss.elastic.co/t/im-getting-searchparseexception-for-constant-score-query-with-one-term-filter/4045/2 "2011-03-06T15:36:50Z")

</div>

oh don't worry, I figured out you still need to wrap the whole thing with  
query :{}

so this works fine

post 127.0.0.1:9200 /index/type/\_search?size=10  
{"query":{"constant\_score":{"filter":{"term":{"site":"fr"}}}}}

On Sun, Mar 6, 2011 at 2:28 PM, Jae Lee [jlee119@gmail.com](mailto:jlee119@gmail.com) wrote:

> Hi,
> 
> I'm getting a SearchParseException when I do
> 
> post 127.0.0.1:9200 /index/type/\_search?size=10  
> {"constant\_score":{"filter":{"term":{"site":"fr"}}}}
> 
> Caused by: org.elasticsearch.search.SearchParseException: [index][4]:  
> from[-1],size[-1]: Parse Failure [No parser for element [constant\_score]]
> 
> whereas if I do
> 
> post 127.0.0.1:9200 /index/type/\_search?size=10  
> {"query":{"term":{"site":"fr"}}}
> 
> it's fine...
> 
> Am I doing something very simple very wrong?
> 
> J

---

<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 6, 2017, 4:10am UTC](https://discuss.elastic.co/t/im-getting-searchparseexception-for-constant-score-query-with-one-term-filter/4045/3 "2017-07-06T04:10:42Z")

</div>


