Elasticsearch 7.10.1 - Indexing term_vector for search_as_you_type field issue

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

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.

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.

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

Thank you for your response @jimczi

Opened a Github bug

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