# Word matching (partial and full)

**URL:** <https://discuss.elastic.co/t/word-matching-partial-and-full/48618>\
**Category:** Elasticsearch\
**Created:** [April 28, 2016, 3:52am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618 "2016-04-28T03:52:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asn/32/10535_2.png) [@ASN](https://discuss.elastic.co/u/ASN)\
**Post date:** [April 28, 2016, 3:52am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/1 "2016-04-28T03:52:41Z")

</div>

Lets say I have a document indexed to ES with

> content: "Tim Cook revealed during the earnings call that iPhone sales in India grew by 56% on a yearly basis, despite the company's first global sales decline in 13 years."  
> Now if a user searches for a word using a match query

```
{
  "query": {
    "match": {
      "answer": {
        "query": "decline"
      }
    }
}}

```

say i get a score of 0.047.

But with the same query, if I search for the word **_"declining"_** , I get a score of 0. I want to check if the word is partially present in the document or not. How can I do this?

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![Gui\_Keller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gui_keller/32/9431_2.png) [@Gui\_Keller](https://discuss.elastic.co/u/Gui_Keller)\
**Post date:** [April 28, 2016, 5:12am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/2 "2016-04-28T05:12:48Z")

</div>

Hi ASN,

Have a look on n-Gram's it should do what you're looking for:

> **[An Introduction to Ngrams in Elasticsearch](https://qbox.io/blog/an-introduction-to-ngrams-in-elasticsearch)**
>
> In this post we will walk though the basics of using ngrams in Elasticsearch.
> Wikipedia has this to say about ngrams:
> In the fields of computational linguistics and probability, an n-gram is a contiguous sequence of n items from a given sequence of...

The official documentation:  
[https://www.elastic.co/guide/en/elasticsearch/guide/current/ngrams-compound-words.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/ngrams-compound-words.html)

Good luck!

---

<div class="post-metadata">

**Author:** ![ASN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asn/32/10535_2.png) [@ASN](https://discuss.elastic.co/u/ASN)\
**Post date:** [April 28, 2016, 5:35am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/3 "2016-04-28T05:35:48Z")

</div>

Thanks Gui.  
As far as I understood (I just started with ES), ngram with tokenizer is splitting the word in individual letters. In that case , even if i match for "dec" then the result is shown. I wanted it to be the word match but some adjectives/adverbs added to it.. like "declining","slow-\>slowly"

Hope I made my point clear.

---

<div class="post-metadata">

**Author:** ![Gui\_Keller](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gui_keller/32/9431_2.png) [@Gui\_Keller](https://discuss.elastic.co/u/Gui_Keller)\
**Post date:** [April 28, 2016, 5:56am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/4 "2016-04-28T05:56:00Z")

</div>

Oh right, you should be looking at synonyms then:  
[https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/synonyms.html)

Which falls under 'dealing with human language' topic:  
[https://www.elastic.co/guide/en/elasticsearch/guide/current/languages.html](https://www.elastic.co/guide/en/elasticsearch/guide/current/languages.html)

Good luck! 🙂

---

<div class="post-metadata">

**Author:** ![ASN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/asn/32/10535_2.png) [@ASN](https://discuss.elastic.co/u/ASN)\
**Post date:** [April 28, 2016, 6:03am UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/5 "2016-04-28T06:03:42Z")

</div>

Thanks Gui.

---

<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 5, 2017, 10:55pm UTC](https://discuss.elastic.co/t/word-matching-partial-and-full/48618/6 "2017-07-05T22:55:41Z")

</div>


