# Scoring Problem with words of one letter

**URL:** <https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167>\
**Category:** Elasticsearch\
**Created:** [June 1, 2018, 8:23am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167 "2018-06-01T08:23:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Youssef1](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@Youssef1](https://discuss.elastic.co/u/Youssef1)\
**Post date:** [June 1, 2018, 8:23am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167/1 "2018-06-01T08:23:12Z")

</div>

Hi Everyone ,  
i'm a beginner in ElasticSearch, i have an application that use elasticSearch to look for ingredients in a given food or fruit...  
i'm facing a problem with scoring if the user for example tape : "Vitamine d"  
ElasticSearch will give the "vitamine" phrase that have the best scoring even if the phrase "Vitamine D" exist and normally it should have the highest score.  
i see that if the second word "d" in my case is just one letter so elastic search will ignore it.

i did another example : "vitamine b12" and i had the correct score .

here is the query that the application send to the server :

{  
"from": 0,  
"size": 5,  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"constNomFr": {  
"query": "vitamine d"  
}  
}  
}  
],  
"should": [  
{  
"prefix": {  
"constNomFr": {  
"value": "vitamine d",  
"boost": 2  
}  
}  
}  
]  
}  
},  
"\_source": {  
"excludes": [  
"alimentDtos"  
]  
}  
}

What i could modify to make it work ?

thank you so much

---

<div class="post-metadata">

**Author:** ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)\
**Post date:** [June 3, 2018, 7:33am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167/2 "2018-06-03T07:33:45Z")

</div>

what's the type of the **constNomFr** field pls?  
if the type is keyword, "vitamine D" won't match the search "vitamine d".  
In that case, this field should be analyzed.

---

<div class="post-metadata">

**Author:** ![Youssef1](https://avatars.discourse-cdn.com/v4/letter/y/ed655f/32.png) [@Youssef1](https://discuss.elastic.co/u/Youssef1)\
**Post date:** [June 5, 2018, 10:55am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167/3 "2018-06-05T10:55:07Z")

</div>

in the mapping i found the following lines :  
"constNomFr" : {  
"type" : "text",  
"analyzer" : "french"  
},

```
"constNomFr" : {
            "type" : "text",
            "fields" : {
              "keyword" : {
                "type" : "keyword",
                "ignore_above" : 256
              }
            }
          }
```

---

<div class="post-metadata">

**Author:** ![klof](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/klof/32/31590_2.png) [@klof](https://discuss.elastic.co/u/klof)\
**Post date:** [June 5, 2018, 11:32am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167/4 "2018-06-05T11:32:45Z")

</div>

Could you show the result of this query?

```
GET index/_analyze
{
  "field": "constNomFr",
  "text": "vitamine D"
}

```

But Have you tried to add the **and operator** to your match clause? By default the match clause will look for documents with "vitamine" OR "d". So that could be the reason as well.

---

<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:** [July 3, 2018, 11:32am UTC](https://discuss.elastic.co/t/scoring-problem-with-words-of-one-letter/134167/5 "2018-07-03T11:32:49Z")

</div>

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