Attachments require a specific mapping. It is likely that your mapping is
not correct. Here is a simple example of how to index a PDF with the proper
attachment type:
class T1
{
}
private static void IndexPdf()
{
var settings = new ConnectionSettings(new
Uri("http://localhost:9200"), "_all");
var client = new ElasticClient(settings);
client.CreateIndex("foo", c => c
.AddMapping<T1>(m => m
.Properties(props => props
.Attachment(s => s
.Name("file")
.FileField(fs => fs.Store())
)
)
)
);
var doc = new { file = new {
content =
Convert.ToBase64String(File.ReadAllBytes(@"C:\ESData\pdf\fn6742.pdf")),
_indexed_chars = -1
}};
client.Index(doc, i => i.Index("foo").Type("t1"));
}
Then after that you can run a search like this:
POST localhost:9200/foo/t1/_search
{
"fields": "file",
"query": {
"match": {
"file": "blah bah"
}
}
}
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/9b3a7cf5-f3b7-45d7-881e-099c803f7bdc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.