本文主要是介绍Elasticsearch 中使用MustNot等同于不登录遇到的坑,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1、在写关键词推荐时,需要把当前文章过滤掉,不能再推荐自己的文章,所以再es中需要用到
MustNot属性查询
/// <summary>
/// 服务中心es检索
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<PagedDto<ThreePartServiceSearchOutput>> GetThreePartServiceSercahPagedAsync(ThreePartServiceSearchInput input)
{
var searchRequest = new SearchRequest<ThreePartServiceIndex>(Nest.Indices.Parse(IndexConsts.ThreePartServiceIndexName));
FieldSort sort = null;
if (!input.KeyWords.IsNullOrWhiteSpace())
{
sort = new FieldSort { Field = Infer.Field<ThreePartServiceIndex>(d => d.ReleaseTime), Order = SortOrder.Descending };
}
else
{
sort = new FieldSort {
这篇关于Elasticsearch 中使用MustNot等同于不登录遇到的坑的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!