[Doc] copy_to using attachment field type #97
Comments
Interesting. I never tested the copy_to feature with plugin. I guess it does not work on a top level attachment field (file) but is only supported with an inner field (file.file). I need to test it and I think to either support it on the top level field or document this. You can also have a look at this commit message: ad986eb It describes how to generate a "sub-field" file.file.store with different analysis settings. In that case we store the sub field but you could change the analyzer. |
Hi, Thanks a lot for giving me the right pointer! Please do check on the sub-field as well I tried that and did not copy the content to an other sub-field either. |
I just checked and indeed The workaround today is to define {
"person": {
"properties": {
"file": {
"type": "attachment",
"path": "full",
"fields": {
"file": {
"type": "string",
"copy_to": "copy"
}
}
},
"copy": {
"type": "string"
}
}
}
} Going to fix this with documentation. |
If you want to use [copy_to](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to) feature, you need to define it on each sub-field you want to copy to another field: ```javascript PUT /test/person/_mapping { "person": { "properties": { "file": { "type": "attachment", "path": "full", "fields": { "file": { "type": "string", "copy_to": "copy" } } }, "copy": { "type": "string" } } } } ``` In this example, the extracted content will be copy as well to `copy` field. Closes #97.
If you want to use [copy_to](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to) feature, you need to define it on each sub-field you want to copy to another field: ```javascript PUT /test/person/_mapping { "person": { "properties": { "file": { "type": "attachment", "path": "full", "fields": { "file": { "type": "string", "copy_to": "copy" } } }, "copy": { "type": "string" } } } } ``` In this example, the extracted content will be copy as well to `copy` field. Closes #97. (cherry picked from commit f4f6b57)
Great thanks for this ! |
Hi,
I am using ES 1.4 with the latest version of the mapper plugin. It is brilliant!
I have a very simple attachment field declared the following way.
I have two questions.
a, I does not seem to honor the copy_to command.
b. I do need to index the attachment with two different analyzer. As I need the RAW content of the file as well as stemmed version of it.
Is there an easier way to achieve this ? As ES does not seem to copy the attachment to exact and also ES seem to be ignoring my index and search analyser on both fields as well.
The documentation does not seem to be clear to me on where I need to configure the analyzer for a given attachment field.
Thanks for any clues !
The text was updated successfully, but these errors were encountered: