# Synonym graph on shingles gives error; works with lenient=true

**URL:** <https://discuss.elastic.co/t/synonym-graph-on-shingles-gives-error-works-with-lenient-true/240558>\
**Category:** Elasticsearch\
**Created:** [July 9, 2020, 3:53pm UTC](https://discuss.elastic.co/t/synonym-graph-on-shingles-gives-error-works-with-lenient-true/240558 "2020-07-09T15:53:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chari](https://avatars.discourse-cdn.com/v4/letter/c/db5fbb/32.png) [@chari](https://discuss.elastic.co/u/chari)\
**Post date:** [July 9, 2020, 3:53pm UTC](https://discuss.elastic.co/t/synonym-graph-on-shingles-gives-error-works-with-lenient-true/240558/1 "2020-07-09T15:53:17Z")

</div>

I get an error :-  
RequestError(400, 'illegal\_argument\_exception', 'failed to build synonyms')  
with the following analyzer, but it works if I set lenient=true. Any insight into why I get an error and if there is any downside to the use of lenient=true ?

```auto
es.indices.create(index= "myIndex", body= {
    "settings": {
      "number_of_shards": 1,
      "analysis": {
         "filter": {
           "shingle_filter":{
              "type" : "shingle",
              "max_shingle_size" : 2,
              "min_shingle_size" : 2,
              "output_unigrams" : "false",
              "output_unigrams_if_no_shingles" : "true",
              "enable_position_increments":"false"
           },
           "kill_filler": {
              "type": "pattern_replace",
              "pattern": ".*_.*",
              "replace": "" 
           },
           "graph_synonyms" : {
                        "lenient": "true", #### error if I remove this 
                        "type" : "synonym_graph",
                        "synonyms_path" : "synonyms.txt"
            },
         },
        "analyzer": {
          "shingle_analyzer": {
            "tokenizer": "standard",
              "filter": [
                "lowercase",
                "stop",
                "graph_synonyms",
                "shingle_filter",
                "kill_filler",
                
              ]
          }
        },  
      }
   },
  "mappings": {
        "properties": {
          "content": {
            "type": "text",
            "fields": {
                "shingles": {
                    "type": "text",
                    "analyzer": "shingle_analyzer"
                }
            }
          },
          "my_join_field": { 
            "type": "join",
            "relations": {
              "document": "page" 
            }
          }   
        }
  }    
})

```

---

<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 6, 2020, 3:53pm UTC](https://discuss.elastic.co/t/synonym-graph-on-shingles-gives-error-works-with-lenient-true/240558/2 "2020-08-06T15:53:22Z")

</div>

Closed on August 6, 2020, 3:53pm UTC

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