Clarity on analyzers


(Wes Plunk) #1

there seems to be two triggers where analyzers are used

  1. executed when the field of a document is indexed
  2. executed when the field of a document is searched

If you analyze the field of a document when it is first indexed does
that mean you don't need to analyze it when it is searched?

If a field is analyzed when it is indexed does that mean it is stored
in the index tokenized (according the analyzer used) forcing you to
either use the _source field or another field to retrieve it's
original form?


(Shay Banon) #2

On Friday, February 3, 2012 at 10:05 PM, Wes Plunk wrote:

there seems to be two triggers where analyzers are used

  1. executed when the field of a document is indexed
  2. executed when the field of a document is searched

If you analyze the field of a document when it is first indexed does
that mean you don't need to analyze it when it is searched?

The part the gets analyzed when you search is the text that you search with. The analyzer will automatically be the one associated with the relevant field you search.

If a field is analyzed when it is indexed does that mean it is stored
in the index tokenized (according the analyzer used) forcing you to
either use the _source field or another field to retrieve it's
original form?

Depends. You can have a field not being analyzed, and then you can search it "unmodified". Multi field mapping can help with having one version of the field analyzed, and another that is not.


(Wes Plunk) #3

Thanks Shay, that's very clear to me now

On Feb 5, 10:21 am, Shay Banon kim...@gmail.com wrote:

On Friday, February 3, 2012 at 10:05 PM, Wes Plunk wrote:

there seems to be two triggers where analyzers are used

  1. executed when the field of a document is indexed
  2. executed when the field of a document is searched

If you analyze the field of a document when it is first indexed does
that mean you don't need to analyze it when it is searched?

The part the gets analyzed when you search is the text that you search with. The analyzer will automatically be the one associated with the relevant field you search.

If a field is analyzed when it is indexed does that mean it is stored
in the index tokenized (according the analyzer used) forcing you to
either use the _source field or another field to retrieve it's
original form?

Depends. You can have a field not being analyzed, and then you can search it "unmodified". Multi field mapping can help with having one version of the field analyzed, and another that is not.


(system) #4