Using different analyzers for a single field (depends on condition)

Hello everybody,

I was just wondering if it could be possible to use different analyzers for
a field which is present in different nested elements. To be more clear,
this is what I would like to do :

Imagine I have this kind of structure :

{
a: [
{
text: blabla,
language: fr
},
{
text: toto,
language: en
}
]
}

What I would like to do is using french analyzer for text with "language:
fr", and english (or standard) analyzer for texy with "language: en". From
what I read, it's not possible, but I would like to know if someone have
found a solution to do this. What I am doing in order to do this is using a
structure like this:

{
a: {
fr: {
text: blabla
},
en: {
text: toto
}
}
}

Using this, I can specify analyzers with the full path, but it could be
great if I can specify analyzers as explained in the first structure (using
script, or a kind of conditionnal analyzer or ...).

Any help would be appreciated :slight_smile:

Regards,
Loïc

--
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/5d4ac492-bf17-40af-a4c3-c99696f19ad3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hey,

using different analyzers in one document, which are extracted from the
document is not possible. However if you have one document per language,
you could use the _analyzer capability for this, see

Hope this helps...

--Alex

On Sat, May 3, 2014 at 8:58 AM, Loïc Wenkin loic.wenkin@gmail.com wrote:

Hello everybody,

I was just wondering if it could be possible to use different analyzers
for a field which is present in different nested elements. To be more
clear, this is what I would like to do :

Imagine I have this kind of structure :

{
a: [
{
text: blabla,
language: fr
},
{
text: toto,
language: en
}
]
}

What I would like to do is using french analyzer for text with "language:
fr", and english (or standard) analyzer for texy with "language: en". From
what I read, it's not possible, but I would like to know if someone have
found a solution to do this. What I am doing in order to do this is using a
structure like this:

{
a: {
fr: {
text: blabla
},
en: {
text: toto
}
}
}

Using this, I can specify analyzers with the full path, but it could be
great if I can specify analyzers as explained in the first structure (using
script, or a kind of conditionnal analyzer or ...).

Any help would be appreciated :slight_smile:

Regards,
Loïc

--
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/5d4ac492-bf17-40af-a4c3-c99696f19ad3%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/5d4ac492-bf17-40af-a4c3-c99696f19ad3%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/CAGCwEM_2cUCA6Ks8C%2BN0BAtE0ZxY_-yxiOjYt_of25Z-omtKgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Hello Alex,

Thanks for your reply. I have already looked at the _analyzer capability,
but it doesn't help me. I will continue using the structure I described
above.

Loïc

Le lundi 5 mai 2014 13:21:30 UTC+2, Alexander Reelsen a écrit :

Hey,

using different analyzers in one document, which are extracted from the
document is not possible. However if you have one document per language,
you could use the _analyzer capability for this, see
Elasticsearch Platform — Find real-time answers at scale | Elastic

Hope this helps...

--Alex

On Sat, May 3, 2014 at 8:58 AM, Loïc Wenkin <loic....@gmail.com<javascript:>

wrote:

Hello everybody,

I was just wondering if it could be possible to use different analyzers
for a field which is present in different nested elements. To be more
clear, this is what I would like to do :

Imagine I have this kind of structure :

{
a: [
{
text: blabla,
language: fr
},
{
text: toto,
language: en
}
]
}

What I would like to do is using french analyzer for text with "language:
fr", and english (or standard) analyzer for texy with "language: en". From
what I read, it's not possible, but I would like to know if someone have
found a solution to do this. What I am doing in order to do this is using a
structure like this:

{
a: {
fr: {
text: blabla
},
en: {
text: toto
}
}
}

Using this, I can specify analyzers with the full path, but it could be
great if I can specify analyzers as explained in the first structure (using
script, or a kind of conditionnal analyzer or ...).

Any help would be appreciated :slight_smile:

Regards,
Loïc

--
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/5d4ac492-bf17-40af-a4c3-c99696f19ad3%40googlegroups.comhttps://groups.google.com/d/msgid/elasticsearch/5d4ac492-bf17-40af-a4c3-c99696f19ad3%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/a0f3e59c-495d-4c54-9133-fd84e932b2b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.