# Issues with commas after non-word character && autocomplete

**URL:** <https://discuss.elastic.co/t/issues-with-commas-after-non-word-character-autocomplete/74719>\
**Category:** Elasticsearch\
**Created:** [February 10, 2017, 10:39pm UTC](https://discuss.elastic.co/t/issues-with-commas-after-non-word-character-autocomplete/74719 "2017-02-10T22:39:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akotlar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akotlar/32/15435_2.png) [@akotlar](https://discuss.elastic.co/u/akotlar)\
**Post date:** [February 10, 2017, 10:39pm UTC](https://discuss.elastic.co/t/issues-with-commas-after-non-word-character-autocomplete/74719/1 "2017-02-10T22:39:12Z")

</div>

Ran into this with query\_string\_query:

If the field is "Homo sapiens stromal cell derived factor, 4 (SDF4), transcript variant 2, mRNA"

- note commas after [^a-zA-Z] characters

searching: Homo sapiens stromal cell derived factor, 4 (SDF4), transcript variant 2, mRNA

- 0 results

searching: Homo sapiens stromal cell derived factor, 4 (SDF4) transcript variant 2 mRNA

- works just fine (note that we keep the comma after r, but not after the 2 or the ))

Completely bizarre: if I index the field using standard tokenizer, and no autocomplete filter, it works just fine. This surprises me, because I use standard tokenizer both during indexing, and search, only difference is at index time I also apply a generous edge\_ngram filter. This is the documented solution for precise search for fields using ngram filters.

My initial thought was that the standard tokenizer does not remove commas after [^a-zA-Z] characters, and that autocomplete does, but the analyze api suggests no commas retained in either case.

Does anyone know how to solve this without resorting to manually stripping commas (and presumably other punctuation)?

Mapping:

autocomplete\_filter:  
type: edge\_ngram  
min\_gram: 2  
max\_gram: 20

autocomplete:  
type: custom  
tokenizer: standard  
filter:  
- standard  
- lowercase  
- autocomplete\_filter

my\_standard:  
tokenizer: standard  
filter:  
- standard  
- lowercase

field index as:

field\_name:  
type: string  
analyzer: autocomplete  
search\_analyzer: my\_standard

---

<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:** [March 10, 2017, 10:39pm UTC](https://discuss.elastic.co/t/issues-with-commas-after-non-word-character-autocomplete/74719/2 "2017-03-10T22:39:17Z")

</div>

Closed on March 10, 2017, 10:39pm UTC

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