If you want to set up a small number of known analyzers but keep the same field to search on, the method ES provides is simple: use different mappings within an index.
For combining analyzers for multilanguage search in a single index/mapping, look at the combo analyzer: https://github.com/yakaz/elasticsearch-analysis-combo I use this analyzer token chaining method for german/english/french words in a single field with success, together with keyword repeat token filter, ICU normalizer, ICU folding, and unique filter, having no need to "switch" analyzers. Jörg On Tue, Aug 19, 2014 at 5:24 PM, Frederic Esnault < [email protected]> wrote: > Hi Jörg and thanks for your answer. > > I agree with, defining my custom analyzer directly would solve the > problem, but i have another constraint, which makes this impossible. > I want to be able to select an analyzer at runtime (when creating the > index), depending on the user locale. > > I had a locale adapter i made myself which converted the locale to an > analyzer name, but i had problem with the french analyzer, which led me to > the current problem. > > So i want to be able to : > 1. override the french analyzer because the built-in french analyzer does > not satisfy me; > 2. set the default analyzer to my custom french analyzer > 3. for people using another language, still be able to get a default > analyzer to english snowball for example. > > > So i'd like to be able to do something like that : > > {...{ "analyzer": "french" { "type":snowball", "language": "French" }, > ..., "default" : "<program-generated-value-here>"} > > The program generated value would be a simple translation of my user's > locale : fr > french, en > english, and so on... > The challenge here is that if "default" is set to "french", it should > reference the custom "french" analyzer. > > > > Le mardi 19 août 2014 17:11:21 UTC+2, Jörg Prante a écrit : > >> This sequence >> >> "default":{ >> "type":"french" >> } >> >> will not work, you do not have an analyzer of type "french". >> >> Just rename the analyzer with name "french" to the name "default" and it >> will be used as default. >> >> Jörg >> >> -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com > <https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoHUZqXEAqEXC2QC75FzFfpDZaZsDLObZZP7999W_-ct1Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
