Search for phrases with special characters - Attachment Content

Hi all,

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@xyz.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, xyz and com separately and generating results. How can I solve this?

TIA

Hi @ASN,

I guess you have problems with the analysis process. See How to Index special characters and Search those special characters in Elasticsearch for more details.

Daniel

Hi @danielmitterdorfer

Thanks for the reply.

From the link you have provided, I understood that using a custom analyzer would help us solve this problem. But I have a doubt .
Is it possible to add multiple analyzers on the same field name? Because as I'm working on attachments and for better search performance i added "english" analyzer already on the Attachment. So is it possible to add another analyzer?

something like this:

 var createIndexResponse =
                client.CreateIndex(defaultIndex, c => c
                .Mappings(m => m
                .Map<Document>(mp => mp
                .Properties(ps => ps
                    .Number(n => n.Name(e => e.Id))
                    .String(s => s.Name(e => e.Title))
                    .Attachment(s => s.Name(p => p.File)
                        .FileField(ff => ff.Name(f => f.File)
                        .TermVector(TermVectorOption.WithPositionsOffsetsPayloads)
                        .Analyzer("english")
                        .Store(true)))))));

Hi @ASN,

yes, this is possible with multi-fields.

Daniel