# \[custom\_score\] query does not support \[facets\]

**URL:** <https://discuss.elastic.co/t/custom-score-query-does-not-support-facets/12360>\
**Category:** Elasticsearch\
**Created:** [June 11, 2013, 11:26am UTC](https://discuss.elastic.co/t/custom-score-query-does-not-support-facets/12360 "2013-06-11T11:26:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nathan\_Keller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nathan_keller/32/2282_2.png) [@Nathan\_Keller](https://discuss.elastic.co/u/Nathan_Keller)\
**Post date:** [June 11, 2013, 11:26am UTC](https://discuss.elastic.co/t/custom-score-query-does-not-support-facets/12360/1 "2013-06-11T11:26:07Z")

</div>

Been up way too late trying to get this to work to no avail. Is there a way  
to get facets AND the custom\_score to work?

Context: I'm trying to personalise ranking, and products in a very fine  
grained manner. The user should be able to facet on size while still having  
the personalised ranking applied. Take a look at [goodguide.com](http://goodguide.com) to get an  
idea for what I'm attempting.

Or should i be using boost somehow? I guess I could set a flag for each of  
the personalised filters, and do a boost it the index value matchs the  
saved user preference value.

Thanks in advance (as always!) for any help,

{

"query":{

```
  "custom_score":{

     "params":{

        "p":0

     },

     "script":"_score * p",

     "query":{

        "filtered":{

           "filter":{

              "fquery":{

                 "query":{

                    "query_string":{

                       "query":"django_ct:(app_name.modelone 

```

OR app\_name.modeltwo)"

```
                    }

                 },

                 "_cache":true

              }

           },

           "query":{

              "query_string":{

                 "query":"(red)",

                 "default_operator":"AND",

                 "default_field":"text",

                 "auto_generate_phrase_queries":true,

                 "analyze_wildcard":true

              }

           }

        }

     },

     "facets":{

        "size_exact":{

           "terms":{

              "field":"size_exact",

              "size":100

           }

        }

     },

     "from":0,

     "size":30

  }

```

}

}

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Alex\_Brasetvik\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_brasetvik_2/32/1994_2.png) [@Alex\_Brasetvik\_2](https://discuss.elastic.co/u/Alex_Brasetvik_2)\
**Post date:** [June 11, 2013, 11:59am UTC](https://discuss.elastic.co/t/custom-score-query-does-not-support-facets/12360/2 "2013-06-11T11:59:35Z")

</div>

On Jun 11, 2013, at 13:26 , Nathan Keller [its@madteckhead.com](mailto:its@madteckhead.com) wrote:

> Been up way too late trying to get this to work to no avail. Is there a way to get facets AND the custom\_score to work?

Hi Nathan,

You've nested facets and other search properties below the query. They should be at the "root" of your search request object, like so:

{  
"query": { … },  
"facets": {  
"size\_exact": {  
"terms": {  
"field": "size\_exact",  
"size": 100  
}  
}  
},  
"from": 0,  
"size": 30  
}

Hope this helps! 🙂

Regards,

Alex Brasetvik

Found AS  
Hosted Elasticsearch – www.found.no – @foundsays

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:31am UTC](https://discuss.elastic.co/t/custom-score-query-does-not-support-facets/12360/3 "2017-07-06T02:31:50Z")

</div>


