Hey,
The exception you are getting, is actually telling the truth a bit, however
it is pretty hard to extract useful information out of it.
You are trying to use the synonym feature on query time, but this is not
possible. The synonym feature is a tokenfilter and has to be configured,
before you start indexing your documents. It is not to be used on query
time at all.
Consider this example:
curl -X DELETE 'localhost:9200/mytest'
curl -XPUT 'localhost:9200/mytest' -d '{
"settings" : {
"analysis" : {
"analyzer" : {
"my_analyzer" : {
"tokenizer" : "standard",
"filter" : [ "lowercase", "your_synonym_filter" ]
}
},
"filter" : {
"your_synonym_filter" : {
"type" : "synonym",
"synonyms" : [
"foo, bar"
]
}
}
}
}
}'
curl -X PUT localhost:9200/mytest/sometype/_mapping -d ' { "sometype" : {
"properties" : { "name" : { "type" : "string", "analyzer":"my_analyzer"} }
} }'
curl -X PUT localhost:9200/mytest/sometype/1 -d '{ "name" : "what a
wonderful bar" }'
curl -X POST localhost:9200/mytest/sometype/_search -d '{ "query" : {
"match" : { "name" : "bar" } } }'
curl -X POST localhost:9200/mytest/sometype/_search -d '{ "query" : {
"match" : { "name" : "foo" } } }'
When configuring the synonym filter in your index configuration, you can
search either for foo or bar and the indexed document will be returned in
both queries.
Hope this helps...
On Thu, Mar 28, 2013 at 1:16 PM, Fadel Chafai fadelmohamed@gmail.comwrote:
hi
how i can combine a prefix query and a synonyme filter ?
this is my query :
{
"query": {
"query_string": {
"query": "samsung",
"analyzer": "synonym",
"fields": [
"name_fr.name_fr",
"name_fr.whitespace",
"name_fr.edge_ngram_front",
"name_fr.edge_ngram_back",
"name_fr.shingle",
"name_fr.shingle_strip_ws",
"name_fr.shingle_strip_apos_and_ws",
"name_fr.analyzer_fr",
"manufacturer",
"description_fr.description_fr",
"description_fr.synonym",
"description_fr.whitespace",
"description_fr.edge_ngram_front",
"description_fr.edge_ngram_back",
"description_fr.shingle",
"description_fr.shingle_strip_ws",
"description_fr.shingle_strip_apos_and_ws",
"description_fr.analyzer_fr",
]
}
},
"min_score": 0.2,
"size": 8,
"filter": {
"synonym": {
"type": "synonym"
},
"and": [
{
"prefix": {
"name_fr.shingle_strip_ws": "samsung"
}
},
{
"query": {
"query_string": {
"query": "exists:type_products_fr"
}
}
}
]
}
}
but I have an exception
nested: QueryParsingException[[magento] No filter registered for
[synonym]];
thank you
--
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.
--
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.