Overriding built-in analyzer and set it as default


(phoenix) #1

Hi everyone,

I'm trying to override the french analyser in my index. What i want is that
this custom 'french' analyzer becomes the default analyzer for all searches
and indexing, if none is given explicitly.

The settings i give are like this :

{
"index":{
"cluster.name":"test-cluster",
"client.transport.sniff":true,
"analysis":{
"filter":{
"french_elision":{
"type":"elision",
"articles":[
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop":{
"type":"stop",
"stopwords":"french",
"ignore_case":true
},
"snowball":{
"type":"snowball",
"language":"french"
}
},
"analyzer":{
"french":{
"tokenizer":"standard",
"filter":[
"french_elision",
"lowercase",
"french_stop",
"snowball"
]
},
"lower_analyzer":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
},
"token_analyzer":{
"type":"custom",
"tokenizer":"whitespace"
},
"default":{
"type":"french"
}
}
}
}
}
The problem is that my analyzer seems to work correctly, but it is not used
as a default.
A test with inquisitor plugin gives me this :

Index: test-indexAnalyzed Textdefaultaime 1cheval 3frenchaim 1cheval 3
lower_analyzerj'aime les chevaux 1token_analyzerj'aime 1les 2chevaux 3
As you can see, the french override analyzer gives me a perfect result, but
the default one gives me wrong result. The verb is not stemmed to 'aim' and
stays 'time' (which is not correct). Only the 'chevaux' word is stemmed to
'cheval' (which is correct).

Do you know what i'm doing wrong ? Or how i could do to tell ElasticSearch
to choose my custom french analyzer as its default analyzer instead of
digging out the built-in french analyzer ?

Note : I tried giving it directly a name instead of a type, but with no
luck, like this : "default": "french"

Thanks for all your help in advance !

--
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/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #2

Hello Frederic ,

I believe you can use the default configuration settings for this -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-mapper.html#_default_mapping

Thanks
Vineeth

On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault <
esnault.frederic@gmail.com> wrote:

Hi everyone,

I'm trying to override the french analyser in my index. What i want is
that this custom 'french' analyzer becomes the default analyzer for all
searches and indexing, if none is given explicitly.

The settings i give are like this :

{
"index":{
"cluster.name":"test-cluster",
"client.transport.sniff":true,
"analysis":{
"filter":{
"french_elision":{
"type":"elision",
"articles":[
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop":{
"type":"stop",
"stopwords":"french",
"ignore_case":true
},
"snowball":{
"type":"snowball",
"language":"french"
}
},
"analyzer":{
"french":{
"tokenizer":"standard",
"filter":[
"french_elision",
"lowercase",
"french_stop",
"snowball"
]
},
"lower_analyzer":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
},
"token_analyzer":{
"type":"custom",
"tokenizer":"whitespace"
},
"default":{
"type":"french"
}
}
}
}
}
The problem is that my analyzer seems to work correctly, but it is not
used as a default.
A test with inquisitor plugin gives me this :

Index: test-indexAnalyzed Textdefaultaime 1cheval 3frenchaim 1cheval 3
lower_analyzerj'aime les chevaux 1token_analyzerj'aime 1les 2chevaux 3
As you can see, the french override analyzer gives me a perfect result,
but the default one gives me wrong result. The verb is not stemmed to 'aim'
and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed
to 'cheval' (which is correct).

Do you know what i'm doing wrong ? Or how i could do to tell ElasticSearch
to choose my custom french analyzer as its default analyzer instead of
digging out the built-in french analyzer ?

Note : I tried giving it directly a name instead of a type, but with no
luck, like this : "default": "french"

Thanks for all your help in advance !

--
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/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5%3D86V%2BJ9ynikWMSj1NK0WU67GaT_o9T76BsVGVHtU1_%2Bg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(phoenix) #3

Hi Vineeth and thanks for your answer.

If i understood correctly, what you suggest is to add a default section
in all mappings, right ?
First, I would prefer to set it once and for all in the global settings.
I'd be surprised there is no way to reference a custom analyzer in the
global default analyzer definition, but maybe...
Second, your link relates to default mapping, not settings.
Finally, could you give me an example of default analyzer using your
solution, just to test ? Documentation is too thin.

Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :

Hello Frederic ,

I believe you can use the default configuration settings for this -

http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/index-modules-mapper.html#_default_mapping

Thanks
Vineeth

On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault <esnault....@gmail.com
<javascript:>> wrote:

Hi everyone,

I'm trying to override the french analyser in my index. What i want is
that this custom 'french' analyzer becomes the default analyzer for all
searches and indexing, if none is given explicitly.

The settings i give are like this :

{
"index":{
"cluster.name":"test-cluster",
"client.transport.sniff":true,
"analysis":{
"filter":{
"french_elision":{
"type":"elision",
"articles":[
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop":{
"type":"stop",
"stopwords":"french",
"ignore_case":true
},
"snowball":{
"type":"snowball",
"language":"french"
}
},
"analyzer":{
"french":{
"tokenizer":"standard",
"filter":[
"french_elision",
"lowercase",
"french_stop",
"snowball"
]
},
"lower_analyzer":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
},
"token_analyzer":{
"type":"custom",
"tokenizer":"whitespace"
},
"default":{
"type":"french"
}
}
}
}
}
The problem is that my analyzer seems to work correctly, but it is not
used as a default.
A test with inquisitor plugin gives me this :

Index: test-index Analyzed Text default aime 1cheval 3 french aim 1
cheval 3 lower_analyzer j'aime les chevaux 1 token_analyzer j'aime 1les 2
chevaux 3
As you can see, the french override analyzer gives me a perfect result,
but the default one gives me wrong result. The verb is not stemmed to 'aim'
and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed
to 'cheval' (which is correct).

Do you know what i'm doing wrong ? Or how i could do to tell
ElasticSearch to choose my custom french analyzer as its default analyzer
instead of digging out the built-in french analyzer ?

Note : I tried giving it directly a name instead of a type, but with no
luck, like this : "default": "french"

Thanks for all your help in advance !

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Jörg Prante) #4

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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAKdsXoG7_j6b06P6vXUqDsgfZnvnxZLcOucuGOT%3DkrnAgyHWTg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(phoenix) #5

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" : ""}

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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/a33dec5c-b98b-4cee-a200-022d138e8ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #6

Hello Frederic ,

This was what i had in mind -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-conf-mappings.html

Place the default mapping under config and index creation will take default
values from there.

Thanks
Vineeth

On Tue, Aug 19, 2014 at 7:58 PM, Frederic Esnault <
esnault.frederic@gmail.com> wrote:

Hi Vineeth and thanks for your answer.

If i understood correctly, what you suggest is to add a default section
in all mappings, right ?
First, I would prefer to set it once and for all in the global settings.
I'd be surprised there is no way to reference a custom analyzer in the
global default analyzer definition, but maybe...
Second, your link relates to default mapping, not settings.
Finally, could you give me an example of default analyzer using your
solution, just to test ? Documentation is too thin.

Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :

Hello Frederic ,

I believe you can use the default configuration settings for this -
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/index-modules-mapper.html#_default_mapping

Thanks
Vineeth

On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault esnault....@gmail.com
wrote:

Hi everyone,

I'm trying to override the french analyser in my index. What i want is
that this custom 'french' analyzer becomes the default analyzer for all
searches and indexing, if none is given explicitly.

The settings i give are like this :

{
"index":{
"cluster.name":"test-cluster",
"client.transport.sniff":true,
"analysis":{
"filter":{
"french_elision":{
"type":"elision",
"articles":[
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop":{
"type":"stop",
"stopwords":"french",
"ignore_case":true
},
"snowball":{
"type":"snowball",
"language":"french"
}
},
"analyzer":{
"french":{
"tokenizer":"standard",
"filter":[
"french_elision",
"lowercase",
"french_stop",
"snowball"
]
},
"lower_analyzer":{
"type":"custom",
"tokenizer":"keyword",
"filter":"lowercase"
},
"token_analyzer":{
"type":"custom",
"tokenizer":"whitespace"
},
"default":{
"type":"french"
}
}
}
}
}
The problem is that my analyzer seems to work correctly, but it is not
used as a default.
A test with inquisitor plugin gives me this :

Index: test-index Analyzed Text default aime 1cheval 3 french aim 1
cheval 3 lower_analyzer j'aime les chevaux 1 token_analyzer j'aime 1les
2chevaux 3
As you can see, the french override analyzer gives me a perfect result,
but the default one gives me wrong result. The verb is not stemmed to 'aim'
and stays 'time' (which is not correct). Only the 'chevaux' word is stemmed
to 'cheval' (which is correct).

Do you know what i'm doing wrong ? Or how i could do to tell
ElasticSearch to choose my custom french analyzer as its default analyzer
instead of digging out the built-in french analyzer ?

Note : I tried giving it directly a name instead of a type, but with no
luck, like this : "default": "french"

Thanks for all your help in advance !

--
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 elasticsearc...@googlegroups.com.

To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/980c2240-15ec-4ba2-ad46-a57e17300070%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/1b619d79-8bc7-4832-8835-7854837d6421%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5nieftiTPGaKZjzkmSKR9XTmB8v%2Bfts6C%2BK5-6CWuLzUA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(phoenix) #7

Sorry but i can't make it work.

I tried this :

{
"record":{
"_all":{
"enabled":false
},
"index_analyzer":"my_french",
"search_analyzer":"my_french",
"properties":{
"_uuid":{
"type":"string",
"store":"yes",
"index":"not_analyzed"
},
"a":{
"type":"multi_field",
"fields":{
"a":{
"type":"string",
"store":"yes",
"index":"analyzed"
},
"raw":{
"type":"string",
"store":"no",
"index":"not_analyzed"
},
"tokens":{
"type":"string",
"store":"no",
"index":"analyzed",
"analyzer":"token_analyzer"
},
"lower":{
"type":"string",
"store":"no",
"index":"analyzed",
"analyzer":"lower_analyzer"
}
}
},
...

But my analyzer is not taken into consideration while searching (but it is
while indexing).

The mapping i get from the created index just states : "analyzer":
"my_french" (it must have concatenated the search_ and index_ analyzers),
but still not working for search.
I have to specify the analyzer in my query. :

{
"query": {
"match": {
"a": {
"query": "aimera"
"analyzer": "my_french"
}
}
}
}

Like this it works, but it's not the behaviour i want.

Le mercredi 20 août 2014 04:24:40 UTC+2, vineeth mohan a écrit :

Hello Frederic ,

This was what i had in mind -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-conf-mappings.html

Place the default mapping under config and index creation will take
default values from there.

Thanks
Vineeth

On Tue, Aug 19, 2014 at 7:58 PM, Frederic Esnault <esnault....@gmail.com
<javascript:>> wrote:

Hi Vineeth and thanks for your answer.

If i understood correctly, what you suggest is to add a default section
in all mappings, right ?
First, I would prefer to set it once and for all in the global settings.
I'd be surprised there is no way to reference a custom analyzer in the
global default analyzer definition, but maybe...
Second, your link relates to default mapping, not settings.
Finally, could you give me an example of default analyzer using your
solution, just to test ? Documentation is too thin.

Le mardi 19 août 2014 14:56:10 UTC+2, vineeth mohan a écrit :

Hello Frederic ,

I believe you can use the default configuration settings for this -
http://www.elasticsearch.org/guide/en/elasticsearch/
reference/current/index-modules-mapper.html#_default_mapping

Thanks
Vineeth

On Tue, Aug 19, 2014 at 5:51 PM, Frederic Esnault esnault....@gmail.com
wrote:

Hi everyone,

I'm trying to override the french analyser in my index. What i want is
that this custom 'french' analyzer becomes the default analyzer for all
searches and indexing, if none is given explicitly.

The settings i give are like this :

{
"index":{
"cluster.name":"test-cluster",
"client.transport.sniff":true,
"analysis":{
"filter":{
"french_elision":{
"type":"elision",
"articles":[
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"c",
"jusqu",
"quoiqu",
"lorsqu",
"puisqu"
]
},
"french_stop":{
"type":"stop",
"stopwords":"french"<span
style="color:rgb(102,102,102);font-family:'Ubu

...

--
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/ce7fa514-1265-470c-8f91-64db35351433%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Jörg Prante) #8

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:

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 <
esnault.frederic@gmail.com> 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" : ""}

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 elasticsearch+unsubscribe@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
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.


(phoenix) #9

Thanks a lot for the combo analyzer tip. I'll give it a try soon.
Right now i found a solution to my problem by setting my_analyzer for all
text fields.
I'll see what the combo can do for me, but seems like a good solution.
Thx !

But i still think that would be nice to be allowed to just reference an
analyzer in the index settings default analyzer field, like 'default':
'my-analyser'.

Le mercredi 20 août 2014 21:05:48 UTC+2, Jörg Prante a écrit :

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 <esnault....@gmail.com
<javascript:>> 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" : ""}

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 elasticsearc...@googlegroups.com <javascript:>.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(vineeth mohan-2) #10

Hello Frederic ,

There is a default-mapping.json option too.
This might be useful to you if you havnt already found it -
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-dynamic-mapping.html

Thanks
Vineeth

On Sat, Aug 23, 2014 at 4:59 PM, Frederic Esnault <
esnault.frederic@gmail.com> wrote:

Thanks a lot for the combo analyzer tip. I'll give it a try soon.
Right now i found a solution to my problem by setting my_analyzer for all
text fields.
I'll see what the combo can do for me, but seems like a good solution.
Thx !

But i still think that would be nice to be allowed to just reference an
analyzer in the index settings default analyzer field, like 'default':
'my-analyser'.

Le mercredi 20 août 2014 21:05:48 UTC+2, Jörg Prante a écrit :

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 esnault....@gmail.com
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" : ""}

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 elasticsearc...@googlegroups.com.
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/3304cac2-861e-4a63-82e6-ddd3bb620aed%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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kYoiOgRjH-0x4PJxKwKcA3oAJzFDEp%3Drp9jHAdhT10ug%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #11