# Is there a way to influence phrase suggester candidates by specifying weights for tokens / docs?

**URL:** <https://discuss.elastic.co/t/is-there-a-way-to-influence-phrase-suggester-candidates-by-specifying-weights-for-tokens-docs/141899>\
**Category:** Elasticsearch\
**Created:** [July 27, 2018, 7:54am UTC](https://discuss.elastic.co/t/is-there-a-way-to-influence-phrase-suggester-candidates-by-specifying-weights-for-tokens-docs/141899 "2018-07-27T07:54:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![varadharajan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/varadharajan/32/33791_2.png) [@varadharajan](https://discuss.elastic.co/u/varadharajan)\
**Post date:** [July 27, 2018, 7:54am UTC](https://discuss.elastic.co/t/is-there-a-way-to-influence-phrase-suggester-candidates-by-specifying-weights-for-tokens-docs/141899/1 "2018-07-27T07:54:09Z")

</div>

We have loaded a few million documents into an elasticsearch cluster, where the documents are frequently occurring phrases in our master set of documents. We are trying to build a context sensitive spell corrector on top of these phrases. At the moment, we are using a phrase suggester with the below configuration:

{  
"suggest": {  
"suggestions": {  
"text": "some text here",  
"phrase": {  
"field": "phrase.shingle",  
"gram\_size": 3,  
"direct\_generator": [  
{  
"field": "phrase.shingle",  
"suggest\_mode": "missing",  
"min\_word\_length": 1,  
"prefix\_length": 3  
}  
]  
}  
}  
}  
}

If i understood the idea correctly, this would make use of edit distance between token candidates present in the cluster and the tokens from the incoming query to arrive at a score. For example, lets sat there are two terms present in the dataset "galaxa" and "galaxy". If the misspelled query from the user is "galaxx" which one of these candidates will be scored higher? Would it also consider the context, i.e. multiple tokens (words) as part of the misspelled user query to arrive at a better candidate? Is there a way with which we can skew few documents (phrases) to give more weight to some terms over the other?

---

<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:** [August 24, 2018, 7:54am UTC](https://discuss.elastic.co/t/is-there-a-way-to-influence-phrase-suggester-candidates-by-specifying-weights-for-tokens-docs/141899/2 "2018-08-24T07:54:12Z")

</div>

Closed on August 24, 2018, 7:54am UTC

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