Elasticsearch根据过滤器列表过滤字符串(Nest)

时间:2017-10-08 08:09:45

标签: c# elasticsearch nest

我有一个包含100'000个名字的列表。我想根据下面类中的过滤器过滤列表,然后从结果中获取一个随机名称。

这已经在使用一些linq-satements了,但随着过滤器列表的增长,它会变慢。

export class UserState{
    constructor(
        public StartsWithFilters: string[], //exclude all names starting with
        public EndsWithFilters: string[], //exclude all names containing
        public ContainsFilters: string[], //exclude all names ending with
        public EqualsFilters: string[], //exclude all names equal to
        public CurrentName : string //the random name from the filtered list
    ){
        this.SelectedNames = [];
    }
}

所有名称都以/ names索引,类型如下:

public class Name{
    public string NameText{get;set;}
}

所以我想用弹性搜索为我做这个。

由于我是Elasticsearch n00b,我希望您能帮助我确定这是否是Elasticsearch的一个很好的用例,或者我是否应该使用其他东西。如果它是一个很好的用例,请建议一个查询,以指出我正确的方向。

我正在使用C#和Nest。

谢谢!

0 个答案:

没有答案