# Filtered custom\_score query

**URL:** <https://discuss.elastic.co/t/filtered-custom-score-query/21123>\
**Category:** Elasticsearch\
**Created:** [December 7, 2014, 8:02am UTC](https://discuss.elastic.co/t/filtered-custom-score-query/21123 "2014-12-07T08:02:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Itai\_Birenshtok](https://avatars.discourse-cdn.com/v4/letter/i/57b2e6/32.png) [@Itai\_Birenshtok](https://discuss.elastic.co/u/Itai_Birenshtok)\
**Post date:** [December 7, 2014, 8:02am UTC](https://discuss.elastic.co/t/filtered-custom-score-query/21123/1 "2014-12-07T08:02:05Z")

</div>

Hi,

Can you please help and explain to me the exact difference between these  
two queries?

1. {  
"query": {  
"custom\_score": {  
"lang": "native",  
"script": "SomeScript",  
"params": {  
"param1": 1.0,  
"param2": 2.0,  
},  
"query": {  
"filtered": {  
"query": {  
"match\_all": {}  
},  
"filter": {  
(all the filters here...)

2. 

{  
"query": {  
"filtered": {  
"query": {  
"custom\_score": {  
"lang": "native",  
"script": "SomeScript",  
"params": {  
"param1": 1.0,  
"param2": 2.0,  
},  
"query": {  
"match\_all": {}  
}  
}  
},  
"filter": {  
(all the filters here...)

I think that the first actually make the filters first and then the query,  
but the first don't.  
why is that?  
is there more differences?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/28896ae6-806b-4aa7-91a0-a7c4451ca1c9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/28896ae6-806b-4aa7-91a0-a7c4451ca1c9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:45am UTC](https://discuss.elastic.co/t/filtered-custom-score-query/21123/2 "2017-07-06T00:45:15Z")

</div>


