# Analyze field for context suggester

**URL:** <https://discuss.elastic.co/t/analyze-field-for-context-suggester/21638>\
**Category:** Elasticsearch\
**Created:** [January 14, 2015, 2:52pm UTC](https://discuss.elastic.co/t/analyze-field-for-context-suggester/21638 "2015-01-14T14:52:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Caragea](https://avatars.discourse-cdn.com/v4/letter/d/e9c0ed/32.png) [@Dan\_Caragea](https://discuss.elastic.co/u/Dan_Caragea)\
**Post date:** [January 14, 2015, 2:52pm UTC](https://discuss.elastic.co/t/analyze-field-for-context-suggester/21638/1 "2015-01-14T14:52:36Z")

</div>

Hi,

Is there a way to analyze a field that is passed to the context suggester?  
If, say, I have this in my mapping:

```
mappings: {
    myitem: {
        title: {type: 'string'},
        content: {type: 'string'},
        user: {type: 'string', index: 'not_analyzed'},
        suggest_field: {
            type: 'completion',
            payloads: false,
            context: {
                user: {
                    type: 'category',
                    path: 'user'
                },
            }
        }
    }
}

```

and I index this doc:  
POST /myindex/myitem/1  
{  
title: "The Post Title"  
content: ...  
user: 123  
suggest\_field: {  
input: "The Post Title",  
context: {  
user: 123  
}  
}  
}

I would like to analyze the input first, split it into separate words, run  
it through lowercase and stop words filters so that the context suggester  
actually gets  
suggest\_field: {  
input: ["post", "title"],  
context: {  
user: 123,  
entity: 'posts'  
}  
}

I know I can pass an array into the suggest field but I would like to  
avoid lowercasing the text, splitting it, running the stop words filter in  
my application, before passing to ES. If possible, I would rather ES do  
this for me. I did try adding an index\_analyzer to the field mapping but  
that didn't seem to achieve anything.

OR, is there another way to get autocomplete suggestions for words?

Cheers,  
Dan

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d8a34b96-c26b-4d83-a664-5b8c79fbe568%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8a34b96-c26b-4d83-a664-5b8c79fbe568%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 12:38am UTC](https://discuss.elastic.co/t/analyze-field-for-context-suggester/21638/2 "2017-07-06T00:38:59Z")

</div>


