Hello,
In my match query,
{
"query": {
"match": {
"message": {
"query": "Quick foxes",
"analyzer": "stop"
}
}
}
}
I would like to use a stop filter for English AND french words at the same time. Would you have a recommendation of how I could do it please ?
dadoonet
(David Pilato)
Category updated
August 11, 2024, 12:48pm
2
dadoonet
(David Pilato)
August 11, 2024, 12:52pm
3
Bonjour Yoann.
You need to index the same text twice:
French analyzer
English analyzer
You can use subfields for that.
Here's an old but still a good source about dealing with multiple languages: Pitfalls of Mixing Languages | Elasticsearch: The Definitive Guide [2.x] | Elastic
HTH
Thank you David for your answer, I'm digging into it.
I thought about creating an analyzer which both language in stop_words to begin with. It could be a little less relevant but much easier to implement:
PUT my-index-000001
{
"settings": {
"analysis": {
"analyzer": {
"my_english_french_analyzer": {
"type": "standard",
"stopwords": ["_english_", "_french_"]
}
}
}
}
}
Would you have an opinion about it?
Thank you (Merci )
dadoonet
(David Pilato)
August 11, 2024, 1:40pm
5
This would work but it might give some inaccurate results.
I mean that you probably also need to configure some stemmer and elision filters. If not, your solution would probably work.
1 Like
These subfields are actually quite powerful. Thank you for the advice.
system
(system)
Closed
September 8, 2024, 1:56pm
7
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.