# How to create multiple context field in elastic search verion 6.2.3 so that i can do and operation with the content

**URL:** <https://discuss.elastic.co/t/how-to-create-multiple-context-field-in-elastic-search-verion-6-2-3-so-that-i-can-do-and-operation-with-the-content/168831>\
**Category:** Elasticsearch\
**Created:** [February 18, 2019, 1:10pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-context-field-in-elastic-search-verion-6-2-3-so-that-i-can-do-and-operation-with-the-content/168831 "2019-02-18T13:10:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akshay\_singh1](https://avatars.discourse-cdn.com/v4/letter/a/e495f1/32.png) [@akshay\_singh1](https://discuss.elastic.co/u/akshay_singh1)\
**Post date:** [February 18, 2019, 1:10pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-context-field-in-elastic-search-verion-6-2-3-so-that-i-can-do-and-operation-with-the-content/168831/1 "2019-02-18T13:10:18Z")

</div>

```
      "suggest": {
        "type": "completion",
        "analyzer": "my_custom_analyzer",
        "preserve_separators": true,
        "preserve_position_increments": true,
        "max_input_length": 50,
        "contexts": [
          {
            "name": "cityName",
            "type": "CATEGORY",
            "path": "cityName"
          },
          {
            "name": "templateTexts",
            "type": "CATEGORY",
            "path": "templateTexts"
          }
        ]
      }

```

here is my suggest mapping.

i want to have query like

```
  "suggest": {
  "contextual": {
    "prefix": "my-text",
    "completion": {
      "field": "suggest",
      "size": 10,
      "skip_duplicates": true,
      "contexts": {
        "cityName": [
          {
            "context": "New Delhi And NCR",
            "boost": 1,
            "prefix": false
          }
        ],
        "templateTexts": [
          {
            "context": "abcd",
            "boost": 1,
            "prefix": false
          }
        ]
      }
    }
  }
  }

```

but when i query it gives me or operation for cityName and template texts.  
Can you plz tell me how to achieve and operation ?

---

<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 18, 2019, 1:13pm UTC](https://discuss.elastic.co/t/how-to-create-multiple-context-field-in-elastic-search-verion-6-2-3-so-that-i-can-do-and-operation-with-the-content/168831/2 "2019-03-18T13:13:47Z")

</div>

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