Elastic String Types


#1

Now a "String" can be either (or both) a "Text" or "Keyword" type.

If it's "text", then Elastic can do a full text search on it.
If it's "keyword", then Elastic can do structured search on it.

Which one takes less of a toll in memory? I would assume keyword but I have no clue whether Elastic is putting even more stuff in memory for the "Text" type.

Also, is there any data type which simply stores the data and can be retrieved when searching by e.g. ID? Both "text" and "keyword" type seems like it needs to put the data in memory, but there are some pieces of data that I don't care about and just need to store and retrieve together when I search via other means.


(David Pilato) #2

If you want to search for exact match, I'd probably use a text type with a keyword analyzer.
If you want to do sorting, aggregations in addition, I'd use a keyword datatype instead.

My 2 cents


#3

*Edit: solved.

Keyword is more memory efficient.


(David Pilato) #4

Please see Text VS Keyword

It'd have been better to keep the discussion in the same thread as it's totally related IMO.


(Mark Walkom) #5