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


(Björn Schmitt) #1

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.
To view this discussion on the web visit 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.


(Binh Ly) #2

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.
To view this discussion on the web visit 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.


(Björn Schmitt) #3

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.
To view this discussion on the web visit 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.


(Binh Ly) #4

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.
To view this discussion on the web visit 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.


(Björn Schmitt) #5

Many thanks, that worked :slight_smile:

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
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.
To view this discussion on the web visit 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.


(system) #6