C#Nest随机分数不适用于过滤器

时间:2015-12-23 13:51:39

标签: elasticsearch nest

这是我的查询,其中我试图获取基于过滤器的随机数据。但是当我应用randomscore()时,数据是空白的。但如果我删除了随机函数,我就能获得数据。

我想知道我的查询中是否有任何错误。

提前致谢

searchResult = 
     Eclient.Search<ElasticSearchObj>(s => 
      s.Indices(ElasticIndexName).Type("doc")
       .From(0).Size(NoOfDataToFetch)               
       .Query(q1 => q1.FunctionScore(fs => 
                fs.Query(q2 => q2.MatchAll())
                   .RandomScore()
                   .Functions(fn => fn.Weight(100000)
                        .Filter(f => f.Term(t => t.host, CurrentHost)),
                          fn => fn.Weight(10).Filter(f => 
                             f.Range(r => 
                                  r.OnField("priority")
                                   .GreaterOrEquals(99) 
                                   .LowerOrEquals(120)))
                                ) ////functions
                              .ScoreMode(FunctionScoreMode.Sum)
                              .BoostMode(FunctionBoostMode.Sum)
                             ) //// function_score
                         )
                     );

0 个答案:

没有答案