Disabling default analyzer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Disabling default analyzer

Greg
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
Reply | Threaded
Open this post in threaded view
|

Re: Disabling default analyzer

kimchy
Administrator
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: http://www.elasticsearch.org/guide/reference/mapping/root-object-type.html.

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

Reply | Threaded
Open this post in threaded view
|

Re: Disabling default analyzer

Greg
Perfect, thank you!

On May 12, 10:53 pm, Shay Banon <[hidden email]> 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:http://www.elasticsearch.org/guide/reference/mapping/root-object-type....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
Reply | Threaded
Open this post in threaded view
|

Re: Disabling default analyzer

kazoompa
This post has NOT been accepted by the mailing list yet.
In reply to this post by kimchy
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.