What will be the beneficial if I do not analyze a text field?

I find that some of my data has to be stored as text field (The are long, not used for sort, aggregation).

But I also do not need to search based on the content of these fields. So I think I should specify the field not being analyzed.

I want to know what would be the beneficial if I do not analyze a text field?

There should be some since I let the elasticsearch doing less work, right?

For example:

Will this improve the index speed?
Will this improve the query speed?
Does this save space?

Yes to 1 and 3 if you only index fields as keywords and not both as default mapping is doing.

“you only index fields as keywords and not both as default mapping is doing.”

Sorry, I do not understand what this mean..

The way I do to make my text fields without being analyzed is to define the mapping like this

"mapping": {
    "my_type": {
        "properties": {
            "search_key": {"type": "keyword"},
            "content": {"type": "text", "index": false}
        }
    } 
}

The content field is the text field. I hope the index: false setting means that es will not analyze the fields, since the index:false means the fields not searchable

Am I doing correct?

If you don't need to search content field, then that's correct to me.
index: false indeed says that the field is not indexed, which means that it does not have to be analyzed as well.

You'll be able to do exact search on search_key, sorting, and aggregations as well.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.