小编Yos*_*hen的帖子

ElasticSearch和附件类型(NEST C#)

我正在尝试使用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)

attachment elasticsearch nest

9
推荐指数
2
解决办法
6898
查看次数

标签 统计

attachment ×1

elasticsearch ×1

nest ×1