# Faceted search returns no facets (if I'm using a match message query)

**URL:** <https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760>\
**Category:** Elasticsearch\
**Created:** [February 12, 2014, 5:37pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760 "2014-02-12T17:37:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bjorn\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Bjorn\_Schmitt](https://discuss.elastic.co/u/Bjorn_Schmitt)\
**Post date:** [February 12, 2014, 5:37pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/1 "2014-02-12T17:37:17Z")

</div>

Hi,

I've used the following request (#1) for searching but the result was  
too inaccurate. Therefore I've changed _query\_string_ to a _match message_  
query and the result was perfect according to my needs. There is only one  
problem, the facets are empty now...

Any help would be appreciated.

Working request but with too inaccurate search results:  
{  
"fields": [  
"question",  
"id",  
"url",  
"category",  
"group"  
],  
"size": 480,  
"sort": {  
"\_score": "desc",  
"popular": "desc"  
},  
"query": {  
"bool": {  
"must": [  
{  
"query\_string": {  
"query": "maschine~",  
"default\_operator": "AND"  
}  
}  
]  
}  
},  
"facets": {  
"type": {  
"terms": {  
"field": "type",  
"size": 200,  
"global": true  
}  
},  
"brand": {  
"terms": {  
"field": "brand.uid",  
"size": 200,  
"global": true  
}  
},  
"category": {  
"terms": {  
"field": "category.uid",  
"size": 200,  
"global": true  
}  
},  
"version": {  
"terms": {  
"field": "version.uid",  
"size": 200,  
"global": true  
}  
},  
"group": {  
"terms": {  
"field": "group.uid",  
"size": 200,  
"global": true  
}  
},  
"platform": {  
"terms": {  
"field": "platform.uid",  
"size": 200,  
"global": true  
}  
},  
"os": {  
"terms": {  
"field": "os.uid",  
"size": 200,  
"global": true  
}  
},  
"tags": {  
"terms": {  
"field": "tags.uid",  
"size": 200,  
"global": true  
}  
}  
}  
}

Perfect search results but no facets data:  
{  
"fields": [  
"question",  
"id",  
"url",  
"category",  
"group"  
],  
"size": 480,  
"sort": {  
"\_score": "desc",  
"popular": "desc"  
},  
"query": {  
"bool": {  
"must": {  
"match": {  
"\_all": {  
"message": {  
"query": "maschine",  
"operator": "and",  
"fuzziness": 0.7  
}  
}  
}  
}  
}  
},  
"facets": {  
"type": {  
"terms": {  
"field": "type",  
"size": 200  
}  
},  
"brand": {  
"terms": {  
"field": "brand.uid",  
"size": 200  
}  
},  
"category": {  
"terms": {  
"field": "category.uid",  
"size": 200  
}  
},  
"version": {  
"terms": {  
"field": "version.uid",  
"size": 200  
}  
},  
"group": {  
"terms": {  
"field": "group.uid",  
"size": 200  
}  
},  
"platform": {  
"terms": {  
"field": "platform.uid",  
"size": 200  
}  
},  
"os": {  
"terms": {  
"field": "os.uid",  
"size": 200  
}  
},  
"tags": {  
"terms": {  
"field": "tags.uid",  
"size": 200  
}  
}  
}  
}

I'm using the bool query because the user has the ability add some terms to  
filter the result.

--  
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/ae868372-7c46-470f-950d-9618225005c4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ae868372-7c46-470f-950d-9618225005c4%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 12, 2014, 7:40pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/2 "2014-02-12T19:40:20Z")

</div>

Can you show a sample document that you think would match and produce some  
results in the facets part? I'm interested to see if I can duplicate your  
problem.

--  
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/7ee6dc3a-c809-4be6-abc8-444ddac5f0a3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/7ee6dc3a-c809-4be6-abc8-444ddac5f0a3%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Bjorn\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Bjorn\_Schmitt](https://discuss.elastic.co/u/Bjorn_Schmitt)\
**Post date:** [February 12, 2014, 11:02pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/3 "2014-02-12T23:02:21Z")

</div>

Thanks for your help!

{  
"\_index": "myindex",  
"\_type": "knowledge",  
"\_id": "1288",  
"\_version": 1,  
"exists": true,  
"\_source": {  
"id": 1288,  
"question": "Est-ce que je dois installer des applications ou des  
bibliotheques de KOMPLETE 9 a nouveau si celles-ci sont déja sur mon  
ordinateur",  
"answer": " Si une application ou une bibliothèque est déjà installée  
sur votre ordinateur (par exemple l'application KONTAKT 5, la bibliothèque  
de samples de KONTAKT 5 ou une bibliothèque de samples basée sur KONTAKT  
comme ABBEY ROAD 60s DRUMMER ou VINTAGE ORGANS), vous ne devez pas  
l'installer à nouveau avec l'installateur de KOMPLETE 9. Au cas où  
l'installateur de KOMPLETE 9 détecte une application qui est plus récente  
que la version livrée avec KOMPLETE 9, il vous présentera un message  
d'avertissement et désélectionnera automatiquement ces applications dans le  
menu d'installation pour éviter de downgrader ces applications. Nous  
recommandons de garder toutes les autres applications sélectionnées à moins  
que vous ayez une bonne raison de le faire. ",  
"type": "0",  
"category": [{  
"uid": 5,  
"title": "Installation"  
}],  
"group": [  
{  
"uid": 15,  
"title": "KOMPLETE"  
},  
{  
"uid": 46,  
"title": "KOMPLETE ULTIMATE"  
}  
],  
"version": [  
{  
"uid": 13,  
"title": "KOMPLETE 9"  
},  
{  
"uid": 28,  
"title": "KOMPLETE ULTIMATE 9"  
}  
],  
"brand": [{  
"uid": 2,  
"title": "KOMPLETE"  
}],  
"os": {},  
"platform": {},  
"tag": {},  
"url": "/some/url/",  
"popular": 1982,  
"featured": false  
}  
}

Maybe it's related to the version we are using currently: 0.20.6

--  
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/d4bcab2e-d417-4351-8dfc-94171924fcc6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d4bcab2e-d417-4351-8dfc-94171924fcc6%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@Binh\_Ly](https://discuss.elastic.co/u/Binh_Ly)\
**Post date:** [February 13, 2014, 2:41pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/4 "2014-02-13T14:41:21Z")

</div>

Looks like it has something to do with the syntax of your match query. If  
you want to search only in the \_all field, change your match query to this:

"query": {  
"bool": {  
"must": {  
"match": {  
"\_all": {  
"query": "blahblah",  
"operator": "and",  
"fuzziness": 0.7  
}  
}  
}  
}  
},

--  
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/fa77662f-14f8-4abc-98d3-f45e0face3fe%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fa77662f-14f8-4abc-98d3-f45e0face3fe%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Bjorn\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/b/3e96dc/32.png) [@Bjorn\_Schmitt](https://discuss.elastic.co/u/Bjorn_Schmitt)\
**Post date:** [February 13, 2014, 2:48pm UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/5 "2014-02-13T14:48:32Z")

</div>

Many thanks, that worked 🙂

I read over the note and thought message would be a keyword...

[http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-match-query.html](http://www.elasticsearch.org/guide/en/elasticsearch/reference/0.90/query-dsl-match-query.html)  
Note, message is the name of a field, you can substitute the name of any  
field (including \_all) instead.

--  
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/587328a1-0c7c-4f6d-b9ca-a9c87171e230%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/587328a1-0c7c-4f6d-b9ca-a9c87171e230%40googlegroups.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, 1:50am UTC](https://discuss.elastic.co/t/faceted-search-returns-no-facets-if-im-using-a-match-message-query/15760/6 "2017-07-06T01:50:29Z")

</div>


