# Problems with context suggester, ES 1.5.2

**URL:** <https://discuss.elastic.co/t/problems-with-context-suggester-es-1-5-2/1517>\
**Category:** Elasticsearch\
**Created:** [May 28, 2015, 9:19pm UTC](https://discuss.elastic.co/t/problems-with-context-suggester-es-1-5-2/1517 "2015-05-28T21:19:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cching](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cching/32/44800_2.png) [@cching](https://discuss.elastic.co/u/cching)\
**Post date:** [May 28, 2015, 9:19pm UTC](https://discuss.elastic.co/t/problems-with-context-suggester-es-1-5-2/1517/1 "2015-05-28T21:19:38Z")

</div>

I am creating some test use cases for what we need using the context suggester. I can get a simple suggest to work and I can get a context suggest to work, but what I can't get to work is a simple suggest without context. I'm getting the following error:

```
BroadcastShardOperationFailedException[[services][0] ]; nested: ElasticsearchException[failed to execute suggest]; nested: ElasticsearchIllegalArgumentException[suggester[completion] doesn't support field [context]]; 

```

Here's a test script:

```
#!/bin/sh
  
echo 'deleting index'
curl -X DELETE localhost:9200/services/ && echo

echo 'creating index'
curl -XPUT localhost:9200/services/ && echo

echo 'creating mapping'
curl -X PUT localhost:9200/services/_mapping/service -d '
{
    "service": {
        "properties": {
            "name": {
                "type" : "string"
            },
            "tag": {
                "type" : "string"
            },
            "suggest_field": {
                "type": "completion",
                "context": {
                    "color": {
                        "type": "category",
                        "path": "color_field",
                        "default": ["red", "green", "blue"]
                    }
                }
            }
        }
    }
}' && echo

echo 'indexing document'
curl -X PUT 'localhost:9200/services/service/1?refresh=true' -d '
{
    "name": "knapsack",
    "suggest_field": {
        "input": ["knacksack", "backpack", "daypack"],
        "context": {
            "color": ["red", "yellow"]
        }
    }
}' && echo

echo 'getting suggest without context'
curl -X POST localhost:9200/services/_suggest?pretty -d '
{
    "suggest" : {
        "text" : "kna",
        "completion" : {
            "field" : "suggest_field",
            "size": 10
        }
    }
}' && echo

echo 'getting suggest with context'
curl -X POST localhost:9200/services/_suggest?pretty -d '
{
    "suggest" : {
        "text" : "kna",
        "completion" : {
            "field" : "suggest_field",
            "size": 10,
            "context": {
                "color": "red"
            }
        }
    }
}' && echo

```

Can anyone see if I'm doing something wrong? Or are you only allowed to specify a context with the context suggester?

---

<div class="post-metadata">

**Author:** ![Pascal\_Heitz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pascal_heitz/32/18953_2.png) [@Pascal\_Heitz](https://discuss.elastic.co/u/Pascal_Heitz)\
**Post date:** [June 9, 2017, 3:54pm UTC](https://discuss.elastic.co/t/problems-with-context-suggester-es-1-5-2/1517/2 "2017-06-09T15:54:34Z")

</div>

I'm having the same problem. Have you figured out what was wrong?

---

<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:** [November 4, 2022, 4:00am UTC](https://discuss.elastic.co/t/problems-with-context-suggester-es-1-5-2/1517/3 "2022-11-04T04:00:18Z")

</div>


