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
Introduce Attachment type for attachment mapping #2085
Comments
@russcam Hi Russ. thanks for the detailed explanation on attachment plugin. |
@russcam Hi Russ.. Is there any plugin or method to check if any new files(either doc or pdf or ppt) are added to a folder and if added, they should be indexed to the ES server as an attachment. TIA :) |
@nasreekar that question would be better asked on discuss.elastic.co as it will have more visibility |
@russcam sure.. thanks.. Asked on the forum. :) |
-1 as is because we are deprecating this plugin in 5.0. |
@dadoonet Deprecated but not removed in 5? This is aimed more at NEST 2.x, although I think it would also be useful to have in NEST 5.x, marked as deprecated. This would help those using the mapper-attachments plugin in 2.x to migrate to using ingest in 5.x more smoothly. |
Indeed. My comment was just here to highlight the fact that this code might be removed in the near future so it might not worth investing too much on it. |
Gotchya. I think it's a small piece of work to have something here to help with using the plugin with NEST. |
@piyushgiri It's not an issue but an enhancement/feature :) There's a PR open with an This doesn't mean that it's going to make it into NEST though, it still needs review and discussion. |
Is there any way in which i can search for phrases with special charecters in the content of the attached file? for eg: i want to search for asn@gmail.com in the contents of all the indexed files. I actually tried it on my code and it seems to be like '@' is not considered and instead it is searching for asn, gmail and com separately and generating results. How can I solve this problem. TIA |
Bumped to 2.3.3...but this change could arguably target 2.4 instead. |
@russcam Hi Russ. I have a doubt in using attachments plugin. when we are attaching any document(say pdf or doc) as an attachment , are the meta fields considered by default or should we set them explicitly? (NEST) for eg: previously i was doing something like below.
Is there any other way in which I can index a document with some more metafields (like I want to add author and modified date of the document )as an attachment?? TIA |
@nasreekar, the mapper attachments plugin extracts metadata fields from the file where they are available (and the plugin can extract them); some of the metadata fields can be explicitly sent when indexing the document and as far as I know, these are the following (in addition to content which is sent as
@dadoonet, is this correct? If you wish to index other data alongside an attachment, then you create other properties on your I've just merged a PR into 2.x that should make it a little easier to use the attachment plugin with NEST.. This will go into the next 2.x release |
@russcam I got it. Thanks Russ. |
The mapper-attachment plugin allows indexing and searching of documents in various different formats such as PDF, Word, etc.
This is exposed in NEST with AttachmentProperty, which can be used to map the properties of a CLR object to the attachment field mapping.
In its simplest form, indexing an attachment need pass a base64 encoded string of the document as the attachment field:
If the attachment mapping has specified other metadata fields to indexed such as
content_type
,language
, etc. these will be extracted from the content field and indexed as requested (NOTE: they do not exist in source, only in the index).The plugin also allows explicit metadata field values to be passed when indexing, by using the name of the metadata field prefixed with an underscore
Having explicit metadata fields affects the structure of the source returned from results e.g.
Here, the first document has an explicit metadata field for
_content_type
, and has therefore passed the attachment content to be indexed as_content
. The second document passed the attachment content against the name of the attachment field.(using explicit metadata fields does not affect the attachment mapping i.e. new fields beginning with underscore are not added to the mapping)
The extracted values are available in the hits
I think we should introduce an
Attachment
type to make using the mapper-attachment plugin easier with NEST toAttachment
type properties to for strongly typed access to fields.Thoughts?
/cc @Mpdreamz, @gmarz
The text was updated successfully, but these errors were encountered: