# Elasticsearch 7.10.1 - Indexing term\_vector for search\_as\_you\_type field issue

**URL:** https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456
**Category:** Elasticsearch
**Created:** [December 11, 2020, 10:13pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456 "2020-12-11T22:13:29Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)
#### Post date: [December 11, 2020, 10:13pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/1 "2020-12-11T22:13:29Z")

</div>

Hi,

Elasticsearch Version: 7.10.1

Getting the following error when trying to index a document

`{"_index":"test1","_type":"_doc","_id":"1000370980","status":400,"error":{"type":"illegal_argument_exception","reason":"cannot index term vector offsets when term vectors are not indexed (field=\"meta.contribGroup.contrib.lnameFname.suggest2._index_prefix\")"}}`

Providing the mapping for the concerned field below

> ```
> "lnameFname": {
> "type": "text",
> "analyzer": "sae_english_1",
> "search_analyzer": "sae_english_1_search",
> "copy_to": [
> "allMeta",
> "autoCompleteAuthor"
> ],
> "fields": {
> "keyword": {
> "type": "keyword",
> "ignore_above": 256
> },
> "lowercase": {
> "type": "keyword",
> "normalizer": "lowercase_normalizer",
> "ignore_above": 256
> },
> "suggest1": {"type": "search_as_you_type"},
> "suggest2": {
> "type": "search_as_you_type",
> "index_options": "offsets",
> "term_vector": "with_positions_offsets"
> },
> "suggest3": {
> "type": "search_as_you_type",
> "analyzer": "sae_english_1"
> },
> "suggest4": {
> "type": "search_as_you_type",
> "analyzer": "sae_english_1",
> "index_options": "offsets",
> "term_vector": "with_positions_offsets"
> }
> }
> },
> 
> ```

This used to work fine before we upgraded Elasticsearch from **7.8.1** to 7.10.1

Any advice will be appreciated.

Thanks

---

<div class="post-metadata">

### Author: ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)
#### Post date: [December 13, 2020, 3:35am UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/2 "2020-12-13T03:35:32Z")

</div>

term vector supposed to configure only root field and shingle subfields, not the prefix but seems like Elasticsearch is trying to create a vector for \_index\_prefix field also for **search-as-you-type** field type.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/4/e/4ea18b67da460b0db338617496f6248443b6dd59.png)

> **[Search-as-you-type field type | Elasticsearch Reference \[7.10\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-as-you-type.html)**

---

<div class="post-metadata">

### Author: ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)
#### Post date: [December 14, 2020, 1:59pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/3 "2020-12-14T13:59:40Z")

</div>

The simple example to replicate the issue

**Template**

```
 PUT _index_template/vector-test
{
    "index_patterns": ["vector-test"],
    "template": {
      "mappings": {
          "properties": {		
      			"TestFieldName": {
      				"type": "text",				
      				"fields": {
      					"suggest2": {
      						"type": "search_as_you_type",
      						"index_options": "offsets",
      						"term_vector": "with_positions_offsets"
      					}
      				}
      			}
          }
      }
    }  
}

```

**Index Data**

```
PUT /vector-test/_doc/1' 
{
    "TestFieldName" : "Test1 Field Value"
}

```

**Error Message**

```
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "cannot index term vector offsets when term vectors are not indexed (field=\"TestFieldName.suggest2._index_prefix\")"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "cannot index term vector offsets when term vectors are not indexed (field=\"TestFieldName.suggest2._index_prefix\")"
  },
  "status" : 400
}

```

As I mentioned the same test case working okay in v7.8.1. Not sure what I am missing.

Thank you for any help.

---

<div class="post-metadata">

### Author: ![jimczi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jimczi/32/47985_2.png) [@jimczi](https://discuss.elastic.co/u/jimczi)
#### Post date: [December 15, 2020, 5:53pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/4 "2020-12-15T17:53:43Z")

</div>

That looks like a legitimate bug, can you open an issue on github with the same reproduction ?

---

<div class="post-metadata">

### Author: ![chandra2037](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chandra2037/32/72142_2.png) [@chandra2037](https://discuss.elastic.co/u/chandra2037)
#### Post date: [December 15, 2020, 8:20pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/5 "2020-12-15T20:20:47Z")

</div>

Thank you for your response @jimczi

Opened a [Github bug](https://github.com/elastic/elasticsearch/issues/66407)

---

<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: [January 12, 2021, 8:20pm UTC](https://discuss.elastic.co/t/elasticsearch-7-10-1-indexing-term-vector-for-search-as-you-type-field-issue/258456/6 "2021-01-12T20:20:53Z")

</div>

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