How to define the analyzer when creating index?


(zhulin) #1

How to define a analyzer for an index, not just field?

It seems by default it will not using the default analyzer I defined in
elasticsearch.yml.
index.analysis.analyzer.default.type: ik

If I request:
http://localhost:9200/useridx/_search?q=Lin it doesn't using the default
analyzer.

And this works:
http://localhost:9200/useridx/_search?analyzer=ik&q=Lin

Do we need each query time set the analyzer?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7b6c3368-d8b4-4178-9a55-d49a0461b1c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(zhulin) #2

At search time, the
http://www.elastic.co/guide/en/elasticsearch/guide/master/_controlling_analysis.html#id-1.5.4.12.18.5.1
http://www.elastic.co/guide/en/elasticsearch/guide/master/_controlling_analysis.html#id-1.5.4.12.18.5.2sequence
is slightly different:

  • The analyzer defined in the query itself, else
  • The analyzer defined in the field mapping, else
  • The default analyzer for the type, which defaults to
  • The analyzer named default in the index settings, which defaults to
  • The analyzer named default at node level, which defaults to
  • The standard analyzer

I notice this, but I haven't define analyzer in field mapping, or for some
type and index.

在 2015年5月4日星期一 UTC+8下午6:27:06,Lin Zhu写道:

How to define a analyzer for an index, not just field?

It seems by default it will not using the default analyzer I defined in
elasticsearch.yml.
index.analysis.analyzer.default.type: ik

If I request:
http://localhost:9200/useridx/_search?q=Lin it doesn't using the default
analyzer.

And this works:
http://localhost:9200/useridx/_search?analyzer=ik&q=Lin

Do we need each query time set the analyzer?

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e184e670-e8e9-42f8-afc0-092c8363e9b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3