# Greek tones problem

**URL:** <https://discuss.elastic.co/t/greek-tones-problem/76732>\
**Category:** Elasticsearch\
**Created:** [February 28, 2017, 7:41am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732 "2017-02-28T07:41:16Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 7:41am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/1 "2017-02-28T07:41:16Z")

</div>

Hello! I am using elasticsearch mainly for greek words searching. My main problem is that i can't find a solution in greek accents when I make a search.For example when I search the word παιδια I want to get back παιδια and παιδιά or when I am writing παιδιά to get back παιδιά and παιδια.These must be implemented for  
α-\>ά  
ο-\>ό  
η-\>ή etc.  
Any suggestions?  
Thank you in advance,  
Gregory

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 28, 2017, 8:08am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/2 "2017-02-28T08:08:41Z")

</div>

I hope the synonym might work with your situation

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 8:11am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/3 "2017-02-28T08:11:48Z")

</div>

Can I use synonym for characters or only for words?

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 28, 2017, 8:15am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/4 "2017-02-28T08:15:14Z")

</div>

I used as word synonym haven't use as characters sysnonym

[https://www.elastic.co/guide/en/elasticsearch/reference/5.0/analysis-mapping-charfilter.html](https://www.elastic.co/guide/en/elasticsearch/reference/5.0/analysis-mapping-charfilter.html)

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 8:19am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/5 "2017-02-28T08:19:38Z")

</div>

Thank you, I have already use it and doesn't help.

---

<div class="post-metadata">

**Author:** ![Greentea](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/greentea/32/15924_2.png) [@Greentea](https://discuss.elastic.co/u/Greentea)\
**Post date:** [February 28, 2017, 8:22am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/6 "2017-02-28T08:22:05Z")

</div>

how about tokenzier? did you used as well?

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 8:27am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/7 "2017-02-28T08:27:36Z")

</div>

I use something like this

{  
"settings": {  
"analysis": {  
"analyzer": {  
"my\_analyzer": {  
"tokenizer": "keyword",  
"char\_filter": [  
"my\_char\_filter"  
]  
}  
},  
"char\_filter": {  
"my\_char\_filter": {  
"type": "mapping",  
"mappings": [  
"α =\> α",  
"α =\> ά"  
]  
}  
}  
}  
}  
}

but this code is false.I can't add two mappings in same character.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 8:39am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/8 "2017-02-28T08:39:32Z")

</div>

Hi @Grigorios_Loukidis,

any reason why you don't use the built-in `greek` analyzer (see [docs](https://www.elastic.co/guide/en/elasticsearch/reference/master/analysis-lang-analyzer.html#greek-analyzer))?

When I test it with "παιδιά":

```auto
POST _analyze
{
    "text": "παιδιά",
    "analyzer": "greek"
}

```

I get:

```auto
{
   "tokens": [
      {
         "token": "απαιδ",
         "start_offset": 0,
         "end_offset": 7,
         "type": "<ALPHANUM>",
         "position": 0
      }
   ]
}

```

I also tried with "άπαδεία" (to check what happens with leading accents):

```auto
POST _analyze
{
    "text": "άνθρωπος",
    "analyzer": "greek"
}

```

And this returns:

```auto
{
   "tokens": [
      {
         "token": "ανθρωπ",
         "start_offset": 0,
         "end_offset": 8,
         "type": "<ALPHANUM>",
         "position": 0
      }
   ]
}

```

If that doesn't suit your needs you could check the [asciifolding token filter](https://www.elastic.co/guide/en/elasticsearch/guide/current/asciifolding-token-filter.html).

Daniel

P.S.: No, I am not fluent in Greek. 🙂

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 8:43am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/9 "2017-02-28T08:43:38Z")

</div>

Daniel, when I text παιδια I need to get back firstly παιδια and secondly παιδιά  
Also, when I text παιδιά I need to get back firstly παιδιά and secondly παιδια.  
We dont care about leading accents, its the same 🙂

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 8:56am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/10 "2017-02-28T08:56:52Z")

</div>

Hi @Grigorios_Loukidis,

just to ensure we're on the same page: The analyzer is used both during index time _and_ search time but you have to search in the correct field. So here is a complete example of what I am talking about:

```auto
DELETE my_test_index

PUT my_test_index
{
   "mappings": {
      "some_type": {
         "properties": {
            "content": {
               "type": "text",
               "analyzer": "greek"
            }
         }
      }
   }
}

POST /my_test_index/some_type
{
    "content": "παιδιά"
}

POST /my_test_index/some_type
{
    "content": "άνθρωπος"
}

GET /my_test_index/some_type/_search
{
    "query": {
        "match": {
           "content": "παιδια"
        }
    }
}

```

This returns:

```auto
{
   "took": 2,
   "timed_out": false,
   "_shards": {
      "total": 5,
      "successful": 5,
      "failed": 0
   },
   "hits": {
      "total": 1,
      "max_score": 0.2876821,
      "hits": [
         {
            "_index": "my_test_index",
            "_type": "some_type",
            "_id": "AVqD7lSD0LG3_Fpe5Jbj",
            "_score": 0.2876821,
            "_source": {
               "content": "παιδιά"
            }
         }
      ]
   }
}

```

Isn't that what you're after?

Daniel

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 9:01am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/11 "2017-02-28T09:01:26Z")

</div>

I will try it and respond you back. Thank you for your help and patience. 🙂

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 9:57am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/12 "2017-02-28T09:57:18Z")

</div>

I think you are right in your example, but I find difficulties using nest in c#

var response = client1.CreateIndex("thetrialindex", s =\> s.Settings(s1 =\> s1.NumberOfShards(5)  
.NumberOfReplicas(5)  
).Mappings(m=\>m.Map("mytype",mt=\>mt.Properties(c=\>c.Text(c1=\>c1  
.Name("ENTITY\_DESC").Analyzer("greek"))))));

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 10:01am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/13 "2017-02-28T10:01:41Z")

</div>

Hi @Grigorios_Loukidis,

my level of C# expertise matches my level of expertise of the Greek language so bear with me. 🙂

Can you please describe the exact problem with the snippet? Does this code not do what you want or doesn't it compile?

Daniel

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 10:19am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/14 "2017-02-28T10:19:35Z")

</div>

I will try to convert it to c# and test it, then I will respond you back.

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 10:38am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/15 "2017-02-28T10:38:44Z")

</div>

It returns me no results. 😏

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 10:49am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/16 "2017-02-28T10:49:11Z")

</div>

Hi @Grigorios_Loukidis,

ok, this specific statement will return no results because it actually creates the index.

You can check whether it did what you intended by using the REST API.

If you use [Console](https://www.elastic.co/guide/en/kibana/current/console-kibana.html) (which you should; it makes it much easier to explore data in Elasticsearch):

```auto
GET /thetrialindex/_mapping

```

Or in this specific case you can also open [http://localhost:9200/thetrialindex/\_mapping](http://localhost:9200/thetrialindex/_mapping) in your browser.

The next step is then to index some documents and finally to issue a query that targets this field. Something along these lines:

```auto
s => s
.Query(q => q
    .Match(p => p.ENTITY_DESC, "παιδιά")
)

```

(example based on the [docs](https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/query-usage.html))

Daniel

---

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [February 28, 2017, 11:47am UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/17 "2017-02-28T11:47:05Z")

</div>

A huge thank to you. It worked after two weeks of hard testing.

---

<div class="post-metadata">

**Author:** ![danielmitterdorfer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/danielmitterdorfer/32/110510_2.png) [@danielmitterdorfer](https://discuss.elastic.co/u/danielmitterdorfer)\
**Post date:** [February 28, 2017, 12:04pm UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/18 "2017-02-28T12:04:40Z")

</div>

Hi @Grigorios_Loukidis,

you are welcome. I am very glad to hear that I could help you and it is is now working as expected. 🙂

Daniel

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2017, 12:04pm UTC](https://discuss.elastic.co/t/greek-tones-problem/76732/19 "2017-03-28T12:04:57Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
