我正在尝试使用elasticsearch/NEST索引pdf文档.
该文件已编制索引,但搜索结果返回0次点击.
我需要搜索结果只返回文档ID和突出显示结果
(没有base64内容)
这是代码:
我会感激任何帮助,
谢谢,
class Program
{
static void Main(string[] args)
{
// create es client
string index = "myindex";
var settings = new ConnectionSettings("localhost", 9200)
.SetDefaultIndex(index);
var es = new ElasticClient(settings);
// delete index if any
es.DeleteIndex(index);
// index document
string path = "test.pdf";
var doc = new Document()
{
Id = 1,
Title = "test",
Content = Convert.ToBase64String(File.ReadAllBytes(path))
};
var parameters = new IndexParameters() { Refresh = true };
if (es.Index<Document>(doc, parameters).OK)
{
// search …Run Code Online (Sandbox Code Playgroud)