Stemmer with query_string : what's the point with my config?


(Tchinkatchuk) #1

Hi all,

I have issues understanding my config and/or search.

I have an index created with : (curl)
{
"settings": {
"index" : {
"analysis" : {
"analyzer" : {
"french_analyzer" : {
"tokenizer" : "standard",
"filter" : ["standard", "lowercase",
"french_stemmer"]
}
},
"filter" : {
"french_stemmer" : {
"type" : "stemmer",
"name" : "french"
}
}
}
}
}
}

and after mapping is added also via curl with :
{
"article":
{
"_all":
{
"enabled" : true
},
"_analyzer" : {
"default" : {
"type" : "french_analyzer"
}
},
"properties":
{
"id":
{
"type":"long",
"index": "no",
"store":"no"
},
"slug":
{
"type":"string",
"index": "not_analyzed",
"store":"no"
},
"code":
{
"type":"string",
"index": "not_analyzed",
"store":"yes",
"boost": 5.0
},
"name":
{
"type":"string",
"index": "analyzed",
"store":"yes",
"boost": 5.0,
"analyzer" : "french_analyzer"
},
"active":
{
"type":"boolean",
"index": "no",
"store":"yes"
},
"suggest":
{
"type" :"completion",
"index_analyzer" : "simple",
"search_analyzer" : "simple"
}
}
}
}

Datas are indexed via bulk file

I am trying to do a query_string search on x fields (not all analyzed by
the stemmer).
curl -XGET 'localhost:9200/quableindex_fr_fr/_search?pretty=true' -d '{
"query": {
"query_string": {
"query": "encastrée",
"fields": [
"description",
"name"
],
"analyzer" : "french_analyzer"
}
},
"sort": {
"_score": {
"order": "desc"
}
},
"explain": false
}'

This is working ie. "encastrée", "encastrable" and "encastrer" are shown as
results. (all from name field)
But if I do not use the analyzer line in the query_string, french stemmer
seems not to be used (while it has been setted in mapping)
curl -XGET 'localhost:9200/quableindex_fr_fr/_search?pretty=true' -d '{
"query": {
"query_string": {
"query": "encastrée",
"fields": [
"description",
"name"
]
}
},
"explain": false
}'

Could anyone explain me ? I think I missed something.

Thanks.

Sylvain

--
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.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #2