# Filter error: facetted search where multiple terms can be selected per facet

**URL:** <https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251>\
**Category:** Elasticsearch\
**Created:** [January 7, 2013, 3:40pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251 "2013-01-07T15:40:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kevin\_van\_Cleef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_van_cleef/32/2382_2.png) [@Kevin\_van\_Cleef](https://discuss.elastic.co/u/Kevin_van_Cleef)\
**Post date:** [January 7, 2013, 3:40pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/1 "2013-01-07T15:40:44Z")

</div>

I'm trying to filter search results based on facetted search where multiple  
terms can be selected per facet. Get some errors where I need some help. Can  
someone point me in de right direction?

Getting error:  
No query registered for [and].

Request body and Response error: [https://gist.github.com/4475755](https://gist.github.com/4475755)  
Index mapping: [https://gist.github.com/4475798](https://gist.github.com/4475798)

Thanks in advance!

Regards,  
Kevin

--

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 7, 2013, 3:43pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/2 "2013-01-07T15:43:01Z")

</div>

Just wondering if your match\_all is correct.  
You wrote:  
"match\_all" :[

]

It should be  
"match\_all" :{}

Does it help?

Le 7 janvier 2013 à 16:40, Kevin van Cleef [kevinvancleef@gmail.com](mailto:kevinvancleef@gmail.com) a écrit :

> I'm trying to filter search results based on facetted search where multiple  
> terms can be selected per facet. Get some errors where I need some help. Can  
> someone point me in de right direction?
> 
> Getting error:  
> No query registered for [and].
> 
> Request body and Response error: [I'm trying to filter the search results based on facetted search where multiple terms can be selected per facet. Request body beneath results in following exception: No query registered for [and]. Someone pointing me in de right direction? · GitHub](https://gist.github.com/4475755)  
> [https://gist.github.com/4475755](https://gist.github.com/4475755)  
> Index mapping: [https://gist.github.com/4475755 ES Mapping · GitHub](https://gist.github.com/4475798)  
> [https://gist.github.com/4475798](https://gist.github.com/4475798)
> 
> Thanks in advance!
> 
> Regards,  
> Kevin
> 
> --

--  
David Pilato  
[http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
[http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Kevin\_van\_Cleef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_van_cleef/32/2382_2.png) [@Kevin\_van\_Cleef](https://discuss.elastic.co/u/Kevin_van_Cleef)\
**Post date:** [January 7, 2013, 4:27pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/3 "2013-01-07T16:27:31Z")

</div>

Thanks David!

Op maandag 7 januari 2013 16:43:01 UTC+1 schreef David Pilato het volgende:

> Just wondering if your match\_all is correct.  
> You wrote:  
> "match\_all" :[
> 
> ]
> 
> It should be  
> "match\_all" :{}
> 
> Does it help?
> 
> Le 7 janvier 2013 à 16:40, Kevin van Cleef \<[kevinv...@gmail.com](mailto:kevinv...@gmail.com)\<javascript:\>\>  
> a écrit :
> 
> I'm trying to filter search results based on facetted search where  
> multiple terms can be selected per facet. Get some errors where I need some  
> help. Can someone point me in de right direction?
> 
> Getting error:  
> No query registered for [and].
> 
> Request body and Response error: [I'm trying to filter the search results based on facetted search where multiple terms can be selected per facet. Request body beneath results in following exception: No query registered for [and]. Someone pointing me in de right direction? · GitHub](https://gist.github.com/4475755)  
> Index mapping: [https://gist.github.com/4475755 ES Mapping · GitHub](https://gist.github.com/4475798)
> 
> Thanks in advance!
> 
> Regards,  
> Kevin
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Kevin\_van\_Cleef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_van_cleef/32/2382_2.png) [@Kevin\_van\_Cleef](https://discuss.elastic.co/u/Kevin_van_Cleef)\
**Post date:** [January 7, 2013, 6:04pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/4 "2013-01-07T18:04:44Z")

</div>

David,

If I don't bother you..

The filters I created on field 'mime\_type' and 'epoch\_accessed' do not  
totally function as expected.  
When I selected multiple mime\_types the filtering is done right, but when I  
selected multiple epoch\_access dates no result is returned. When I select  
only one access\_date it works as expected. Can you tell me how I can  
accomplish this kind of filter functionality.

"filter":{

```
                          "and":[

                             {

                                           "range":{

                                                   "epoch_created":[

                                                           {

                                                                   "from":1339200000000,

                                                               "to":1339286400000

                                                          },

                                                          {

                                                                   "from":1343001600000,

                                                               "to":1343088000000

                                                          }

                                                   ]

                                           }

                                   },

                                  {

                                           "terms":{

                                                   "mime_type":[

                                                       "image\/jpeg",

                                                      "image\/gif"

                                                ]

                                           }

                                   }

                           ]

                   }

```

Regards,  
Kevin

Op maandag 7 januari 2013 16:43:01 UTC+1 schreef David Pilato het volgende:

> Just wondering if your match\_all is correct.  
> You wrote:  
> "match\_all" :[
> 
> ]
> 
> It should be  
> "match\_all" :{}
> 
> Does it help?
> 
> Le 7 janvier 2013 à 16:40, Kevin van Cleef \<[kevinv...@gmail.com](mailto:kevinv...@gmail.com)\<javascript:\>\>  
> a écrit :
> 
> I'm trying to filter search results based on facetted search where  
> multiple terms can be selected per facet. Get some errors where I need some  
> help. Can someone point me in de right direction?
> 
> Getting error:  
> No query registered for [and].
> 
> Request body and Response error: [I'm trying to filter the search results based on facetted search where multiple terms can be selected per facet. Request body beneath results in following exception: No query registered for [and]. Someone pointing me in de right direction? · GitHub](https://gist.github.com/4475755)  
> Index mapping: [https://gist.github.com/4475755 ES Mapping · GitHub](https://gist.github.com/4475798)
> 
> Thanks in advance!
> 
> Regards,  
> Kevin
> 
> --
> 
> --  
> David Pilato  
> [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<div class="post-metadata">

**Author:** ![Kevin\_van\_Cleef](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kevin_van_cleef/32/2382_2.png) [@Kevin\_van\_Cleef](https://discuss.elastic.co/u/Kevin_van_Cleef)\
**Post date:** [January 7, 2013, 7:43pm UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/5 "2013-01-07T19:43:51Z")

</div>

After some time searching found the solution already. See below:

"filter":{  
"and":[  
{  
"terms":{  
"mime\_type":[  
"image/gif",  
"image/jpeg"  
]  
}  
},  
{  
"or":[  
{  
"range":{

"epoch\_created":{

"from":1339200000000,

"to":1339286400000  
}  
}  
},  
{  
"range":{

"epoch\_created":{

"from":1341446400000,

"to":1341532800000  
}  
}  
}  
]  
}  
]  
}

Op maandag 7 januari 2013 19:04:44 UTC+1 schreef Kevin van Cleef het  
volgende:

> David,
> 
> If I don't bother you..
> 
> The filters I created on field 'mime\_type' and 'epoch\_accessed' do not  
> totally function as expected.  
> When I selected multiple mime\_types the filtering is done right, but when  
> I selected multiple epoch\_access dates no result is returned. When I select  
> only one access\_date it works as expected. Can you tell me how I can  
> accomplish this kind of filter functionality.
> 
> "filter":{
> 
> ```
> "and":[
> 
> {
> 
> "range":{
> 
> "epoch_created":[
> 
> {
> 
> "from":1339200000000,
> 
> "to":1339286400000
> 
> },
> 
> {
> 
> "from":1343001600000,
> 
> "to":1343088000000
> 
> }
> 
> ]
> 
> }
> 
> },
> 
> {
> 
> "terms":{
> 
> "mime_type":[
> 
> "image\/jpeg",
> 
> "image\/gif"
> 
> ]
> 
> }
> 
> }
> 
> ]
> 
> }
> 
> ```
> 
> Regards,  
> Kevin
> 
> Op maandag 7 januari 2013 16:43:01 UTC+1 schreef David Pilato het volgende:
> 
> > Just wondering if your match\_all is correct.  
> > You wrote:  
> > "match\_all" :[
> > 
> > ]
> > 
> > It should be  
> > "match\_all" :{}
> > 
> > Does it help?
> > 
> > Le 7 janvier 2013 à 16:40, Kevin van Cleef [kevinv...@gmail.com](mailto:kevinv...@gmail.com) a  
> > écrit :
> > 
> > I'm trying to filter search results based on facetted search where  
> > multiple terms can be selected per facet. Get some errors where I need some  
> > help. Can someone point me in de right direction?
> > 
> > Getting error:  
> > No query registered for [and].
> > 
> > Request body and Response error: [I'm trying to filter the search results based on facetted search where multiple terms can be selected per facet. Request body beneath results in following exception: No query registered for [and]. Someone pointing me in de right direction? · GitHub](https://gist.github.com/4475755)  
> > Index mapping: [https://gist.github.com/4475755 ES Mapping · GitHub](https://gist.github.com/4475798)
> > 
> > Thanks in advance!
> > 
> > Regards,  
> > Kevin
> > 
> > --
> > 
> > --  
> > David Pilato  
> > [http://www.scrutmydocs.org/](http://www.scrutmydocs.org/)  
> > [http://dev.david.pilato.fr/](http://dev.david.pilato.fr/)  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

--

---

<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:57am UTC](https://discuss.elastic.co/t/filter-error-facetted-search-where-multiple-terms-can-be-selected-per-facet/10251/6 "2017-07-06T02:57:32Z")

</div>


