New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mapper: An analyzer mapper allowing to control the index analyzer of a document based on a document field #485
Comments
Mapper: An analyzer mapper allowing to control the index analyzer of a document based on a document field, closed by 171fa4a. |
Hi Shay, When indexing a document with: value is null, because context.doc() doesn't contain the analyzer field in it. Sebastian. |
Did you set a mapping for type Maybe there should be a default for this, for example, if you place in the json |
Yes I did, the file looks like: { I will try the "_analyzer" default one Thanks |
I see the problem, because the mapping you have is not dynamic, then you need to explicitly define the "analyzer_field" in the properties mapping so it will get added to the document. Same will happen with |
I see, (well, sort of trying to). I didn't use dynamic mappings as a safety measure, to rule out wrong mappings from my client code, so I won't push invalid unsearchable data to an index, with the overhead it involves taking into account the scale and scarcity of a SSD space for example. Do you think this is not a good idea? So, what are my options? What do you mean by define an "_analyzer" or "analyzer_field" in the properties mapping? Adding another field like "title" but containing what? Thanks |
add a mapping called in the same name (like analyzer_field) of type string. |
Hi Shay, |
To be more precise I added: |
Answering to myself, so somebody looking at the issue can use the information. I tried both index and store in "no" and it works:
|
The past post wasn't accurate, I made a mistake interpreting the results, the one that works is: Shay, is there a way to avoid adding that "_analyzer" stored field in every document? |
Pushed support for specifying |
…a document based on a document field, closes elastic#485.
* origin/master: Bump version to 5.1.2 (elastic#485)
The
_analyzer
mapping allows to use a document field property as the name of the analyzer that will be used to index the document. The analyzer will be used for any field that does not explicitly defines ananalyzer
orindex_analyzer
.Here is a sample mapping:
The above will use the value of the
my_field
to lookup an analyzer registered under it. For example, indexing a the following doc:Will cause the
whitespace
analyzer to be used as the index analyzer for all fields without explicit analyzer setting.The default
path
value is_analyzer
, so the analyzer can be driven for a specific document by setting_analyzer
field in it. If custom json field name is needed, an explicit mapping with a differentpath
should be set.The text was updated successfully, but these errors were encountered: