This is a part of the Elasticsearch's document for store
option of text
type:
By default, field values are indexed to make them searchable, but they are not stored. This means that the field can be queried, but the original field value cannot be retrieved.
I don't understand what does it mean by fields are not stored by default. How is this possible? I'm sure that I'm missing something here. Can someone explain it in plain English to me?
CodePudding user response:
let's suppose if you want to store hello world in Elasticsearch
in title
and want to come that in search result, when you search with any word in the title for example : hello
or world
or Elasticsearch
.. than you need to have tokens of these search term in Elasticsearch inverted index..
By default, all Elasticsearch text fields goes through text analysis(that creates the tokens(world in plain english) for the input text).
Now in our example, given title would generate below tokens, that you also verify urself using below API
GET http://es:9200/_analyze
{
"text" : "hello world in Elasticsearch",
"analyzer": "standard"
}
And resultant tokens
{
"tokens": [
{
"token": "hello",
"start_offset": 0,
"end_offset": 5,
"type": "<ALPHANUM>",
"position": 0
},
{
"token": "world",
"start_offset": 6,
"end_offset": 11,
"type": "<ALPHANUM>",
"position": 1
},
{
"token": "in",
"start_offset": 12,
"end_offset": 14,
"type": "<ALPHANUM>",
"position": 2
},
{
"token": "elasticsearch",
"start_offset": 15,
"end_offset": 28,
"type": "<ALPHANUM>",
"position": 3
}
]
}
Now store means the complete string aka (not tokenized) hello world in Elasticsearch
of a field which is not useful for full-text search and as explained in Elasticsearch article stored by default as part of _source
.
Hope this helps.