在 Elasticsearch.net 上对 stopword_path 使用停止过滤器,嵌套

Use the Stop Filter with stopword_path on Elasticsearch.net, Nest

如何使用停止过滤器...与 stopword_path ?? 我可以在邮递员中使用停止过滤器

这是我的代码。

    "analysis" : {
    "analyzer" : {
        "ilhee_Custom" : {
            "type": "custom",
                "tokenizer" : "whitespace",
                "filter" : ["lowercase", "my_stoplist"]
                 }
            },
    "filter" : {
         "my_stoplist" : {
            "type" : "stop",
                "stopwords_path" : "stopword_list.txt",
                    "remove_trailing" : true
                    }
                }
            }
    }

我找到答案了!!是..对吗?

     var stoplist = new StopTokenFilterDescriptor();
        stoplist.StopWordsPath(@"\stopword_list.txt");   
       var createIndexResponse = client.CreateIndex("ilhee", c => c
        .Settings(s => s
         .Analysis(a => a
          .Analyzers(ad => ad       
           // give the custom analyzer a name
           .Custom("ilhee_Custom", ca => ca
            .Tokenizer("standard")
            .Filters("lowercase", "stop", "standard", "snowball","my_stoplist")
           )
          )
          .TokenFilters(s1=>s1
          .UserDefined("my_stoplist",stoplist))
            )       
         )
    );

那行得通。您还可以在 TokenFiltersDescriptor

上使用 Stop() 方法
var createIndexResponse = client.CreateIndex("ilhee", c => c
    .Settings(s => s
        .Analysis(a => a
            .Analyzers(ad => ad
                // give the custom analyzer a name
                .Custom("ilhee_Custom", ca => ca
                    .Tokenizer("standard")
                    .Filters("lowercase", "stop", "standard", "snowball", "my_stoplist")
                )
            )
            .TokenFilters(s1 => s1
                .Stop("my_stoplist", tf => tf
                    .StopWordsPath("stopword_list.txt")
                )
            )
        )   
    )
);

Path is relative to config location or an absolute path.