# Phrase Match Inconsistencies using synonyms and slop

**URL:** <https://discuss.elastic.co/t/phrase-match-inconsistencies-using-synonyms-and-slop/111756>\
**Category:** Elasticsearch\
**Created:** [December 14, 2017, 11:29am UTC](https://discuss.elastic.co/t/phrase-match-inconsistencies-using-synonyms-and-slop/111756 "2017-12-14T11:29:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasikiran](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@sasikiran](https://discuss.elastic.co/u/sasikiran)\
**Post date:** [December 14, 2017, 11:29am UTC](https://discuss.elastic.co/t/phrase-match-inconsistencies-using-synonyms-and-slop/111756/1 "2017-12-14T11:29:56Z")

</div>

hi,  
I'm using elastic search 2.4 - phrase match query with synonyms. Following is the setup and issues faced. Please suggest. I'm trying to index and access the index in the same session.

The input to the following index settings is lemmatized text (from wordnet)-  
"Updating Mobile Phone number in BANK Updating Mobile Phone number in BANK.txt "

nlp\_settings\_cssections = {  
"settings": {  
"number\_of\_shards": 1,  
"analysis": {  
"char\_filter": {  
"my\_char\_filter": {  
"type": "mapping",  
"mappings": [  
"\n =\> .",  
"1 =\> 1"]  
}  
},  
"filter": {  
"my\_synonym\_filter": {  
"type": "synonym",  
"synonyms": []  
},  
"english\_stop": {  
"type": "stop",  
"stopwords": "_english_"  
},  
"english\_stemmer": {  
"type": "stemmer",  
"language": "light\_english"  
},  
"english\_possessive\_stemmer": {  
"type": "stemmer",  
"language": "possessive\_english"  
}  
},  
"analyzer": {  
"my\_english\_analyzer": {  
"type": "custom",  
"char\_filter": [  
"my\_char\_filter"  
],  
"tokenizer": "standard",  
"filter": [  
"english\_possessive\_stemmer",  
"lowercase",  
"my\_synonym\_filter",  
"english\_stemmer"

```
              ]
            }
        }
    }

```

},  
"mappings": {  
"section": {  
"properties": {  
"seccontent": {  
"type": "string",  
"analyzer": "my\_english\_analyzer"  
}}}}  
}

**Synonyms**  
option 1. "click on service catalog, change, updating, changing, update"  
option 2. "click on service catalog, change, updating, changing =\> update"

**Phrase Query**  
query\_phrase\_cssections = json.dumps(  
{"from": 0, "size": 20,  
"query": {  
"match\_phrase": {  
"seccontent": {  
"query": "%s",  
"slop": 3  
}  
}  
}  
}

**Issue -**  
I use synonym option 1, i get result for phrase "update phone"  
I use synonym option 2, i don't get results.  
Synonym option 1 seem to be getting results from other documents where only one of  
update / phone are present in the document at distance of slop 3.

---

<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:** [January 11, 2018, 11:30am UTC](https://discuss.elastic.co/t/phrase-match-inconsistencies-using-synonyms-and-slop/111756/2 "2018-01-11T11:30:34Z")

</div>

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