0

I am using "Nest" Elastic Search to index my documents. everything is working normally: indexing and retrieve Documents.

I need to search the content of any document type, i installed the "mapper attachment types" plugin, and restarted the elastic search service.

When indexing the document, i convert its content to base64 as requested.

     foreach (string file in Directory.GetFiles(@"C:\Lucene\sample"))
        {
            var document = new Document
            {
                ID = counter++ ,
                Name = "Current file " + counter.ToString(),
                Content =  Convert.ToBase64String(File.ReadAllBytes(file)),
                IsLatest = true,
                VersionNo = 1,
                FilePath = file ,
            };

However, when searching i cannot get any result. Using the url "http://localhost:9200/my_first_index/Node/20?pretty" i can retreive the following document:

     {
     "_index" : "my_first_index",
     "_type" : "Node",
      "_id" : "20",
      "_version" : 1,
      "found" : true,
      "_source":{
      "_id": 20,
      "name": "Current file 21",
      "content":                         

         "QXJjaGl0ZWN0aW5nIEFwcGxpY2F0aW9ucyBmb3IgdGhlIFJ
         lYWwgV29ybGQgaW4gLk5FVAydCAtIERlc2lnbiBQYXR0ZXJucyBPbi1SYW",
      "originalNodeID": 0,
      "versionNo": 1,  "isLatest": true,
      "path": "C:\\Lucene\\sample\\extensible software downloads.txt"
  }
  }

Also, searching for another non content fields is working normally.

Is there any thing that i have missed?

Hussein Salman
  • 7,806
  • 15
  • 60
  • 98

0 Answers0