Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
OpenSearch server v 2.11.0
Describe the issue:
Hi,
I am getting a “Document contains at least one immense term in field” error when indexing a document with a largish (~100 KB) value in a ‘flat_object’ type field. I thought the purpose of the flat_object field was to allow storing (but not indexing) large structured data (from the documentation: “The flat object field type solves this problem by treating the entire JSON object as a string. Subfields within the JSON object are accessible using standard dot path notation, but they are not indexed for fast lookup.”)…
The error says that there is a 32K limit to the term size:
Document contains at least one immense term in field="foo._value" (whose UTF8 encoding is longer than the max length 32766), all of which were skipped. Please correct the analyzer to not produce such terms. The prefix of the first immense term is: '[83, 111, 117, 114, 99, 101, 32, 69, 120, 116, 101, 110, 115, 105, 111, 110, 32, 83, 101, 116, 115, 58, 68, 97, 116, 97, 32, 81, 117, 97]...', original message: bytes can be at most 32766 in length; got 99431
Why is the term length even an issue here? I just want to store the value - not index it. Do flat_object fields get indexed as a single term? I tried explicitly configuring the mapping to tell it not to index the field:
PUT /testindex/_mapping
{
"properties": {
"foo": {
"type": "flat_object",
"index": false
}
}
}
but that resulted in an error:
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [foo] has unsupported parameters: [index : false]"
}
],
"type": "mapper_parsing_exception",
"reason": "Mapping definition for [foo] has unsupported parameters: [index : false]"
},
"status": 400
}
The flat_object documentation notes that “The maximum field value length in the dot notation is 2^24 − 1.”, which is ~16 MB, so why am I having trouble inserting a mere 100 KB value into a flat_object type field?
Any insight would be much appreciated.