Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the maximum length for keyword type in elasticsearch?

Here is documentation about keywords but they haven't tell any limits. The fault lenght as I spot is 256 characters but how to get maximum length for keyword datatype?

like image 354
Cherry Avatar asked Nov 08 '17 10:11

Cherry


People also ask

What is keyword type in Elasticsearch?

The keyword family includes the following field types: keyword , which is used for structured content such as IDs, email addresses, hostnames, status codes, zip codes, or tags. constant_keyword for keyword fields that always contain the same value. wildcard for unstructured machine-generated content.

Is Elasticsearch keyword case sensitive?

Problem here is that while indexing, as you have used keyword field, so tokens in elasticsearch inverted index, which is used to match the tokens of search query are not lowercased so it is not possible at all to provide case-insensitive search.

What is difference between keyword and text in Elasticsearch?

The crucial difference between them is that Elasticsearch will analyze the Text before it's stored into the Inverted Index while it won't analyze Keyword type. Analyzed or not analyzed will affect how it will behave when getting queried.

What is field keyword?

Keyword fields are used to index and search for exact values, and are often used for filtering and aggregations.


1 Answers

The maximum bytes can be at most 32766. You will get a following error reason when the bytes go beyond 32766.

"reason": "Document contains at least one immense term in field=\"tags\" (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: '[82, 83, 75, 66, 99, 81, 87, 70, 69, 72, 49, 65, 70, 71, 48, 48, 53, 101, 86, 54, 112, 67, 53, 54, 80, 112, 56, 54, 70, 72]...', original message: bytes can be at most 32766 in length; got 32770",
"caused_by": {
  "type": "max_bytes_length_exceeded_exception",
  "reason": "bytes can be at most 32766 in length; got 32770"
}
like image 194
swapnil2993 Avatar answered Nov 15 '22 05:11

swapnil2993