Reputation: 6558
What does Elastic/Lucene do with a field that is not analyzed? It doesn't have to create an inverted index or positions for that field value (I would imagine). It only needs to record the value?
I suspect it still makes an inverted index with only ever one term. And the positions for the term would always be anchored at the beginning of the field and the end of the field. Does that seem accurate?
Upvotes: 0
Views: 99
Reputation: 217254
In ES 2.x, when declaring a string
field, you had three options regarding how it is indexed. You can declare the field with
index: analyzed
, in which case the string content was analyzed and indexed (-> analyzed tokens were stored in the inverted index)index: not_analyzed
, in which case the string content was not analyzed but still indexed "as is" (-> the exact string was stored unaltered in the inverted index). In addition, the exact value is also stored in the doc values indexindex: no
, in which case the string content was not analyzed and not indexed at all (and thus not searchable)In ES 5.x, you now have two different field types, namely:
text
which is the same as what index: analyzed
used to be (case 1 above)keyword
which is the same as what index: not_analyzed
used to be (case 2 above)In addition, both fields now still accept the index
parameter, but only with value true
or false
. So basically, you now have four possibilities, but only three really make sense:
text
+ index: true
, which is the normal case when you want to analyze your string and index it (same as case 1)text
+ index: false
, which doesn't really make sense as there is no reason to analyze a string and not index itkeyword
+ index: true
, which is when you want to not analyze your string but still index the value as is (same as case 2)keyword
+ index: false
, which is when you want to not analyze your string and not index it either (same as case 3)For cases 3 and 4, the value is also stored in the doc values index by default.
Upvotes: 1