Disabling default analyzer

Hi all

A bit of a newbie question: I don't want elasticsearch to tokenize any
of my fields. What is the best way to disable the default analyzer?

Alternatively, is it possible to have the automatic mapping default to
"not_analyzed" for each field?

Many thanks
Greg

Hey,

You have two options, the first is to set the default analyzer when you create an index to type keyword (which means treating the whole text as a single keyword). Here is a sample:

curl -XPUT localhost:9200/test -d '{
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"type" : "keyword"
}
}
}
}
}'

The other is to use dynamic_tempaltes to have all string type fields to have index set to not_analyzed. See dynamic template docs here: Elasticsearch Platform — Find real-time answers at scale | Elastic.
On Thursday, May 12, 2011 at 8:26 PM, Greg wrote:
Hi all

A bit of a newbie question: I don't want elasticsearch to tokenize any
of my fields. What is the best way to disable the default analyzer?

Alternatively, is it possible to have the automatic mapping default to
"not_analyzed" for each field?

Many thanks
Greg

Perfect, thank you!

On May 12, 10:53 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Hey,

You have two options, the first is to set the default analyzer when you create an index to type keyword (which means treating the whole text as a single keyword). Here is a sample:

curl -XPUT localhost:9200/test -d '{
"index" : {
"analysis" : {
"analyzer" : {
"default" : {
"type" : "keyword"

}
}
}
}
}'

The other is to use dynamic_tempaltes to have all string type fields to have index set to not_analyzed. See dynamic template docs here:Elasticsearch Platform — Find real-time answers at scale | Elastic Thursday, May 12, 2011 at 8:26 PM, Greg wrote:

Hi all

A bit of a newbie question: I don't want elasticsearch to tokenize any
of my fields. What is the best way to disable the default analyzer?

Alternatively, is it possible to have the automatic mapping default to
"not_analyzed" for each field?

Many thanks
Greg

Hi,

I am also trying to not analyze ONE field. I tried to modify my default settings YAML by translating the documentaion JSON but no luck. I couldn't find any example that uses the YAML format.

Here is my settings in YAML:

index:
analysis:
analyzer:
my_index_analyzer:
type: custom
tokenizer: standard
filter: [standard,lowercase,my_filter]
my_search_analyzer:
type: custom
tokenizer: standard
filter: [standard,lowercase]
filter:
my_filter:
type: nGram
min_gram: 2
max_gram: 20
dynamic_templates:
exact_match:
match: fullName
mapping:
type: string
fields:
"{name}": "{type}": "{dynamic_type}", index: not_analyzed

I tried several version of the last line and no luck.

Any help will be greatly appreciated.