常用 elasticsearch 查询 及 java 实现

2021-01-26 22:13

阅读:795

标签:this   java   index   tor   like   elastic   key   highlight   color   

collopse

{
   "size":3,
   "query":{   
        "more_like_this":{   
            "fields" : ["remark"],   
            "like" : ["特价","套装" ],
            "min_term_freq" : 1,
            "max_query_terms" : 1
        }   
    } ,
      
    "collapse" : {
        "field" : "userid.keyword" 
    },
    "_source":["userid"],
 

    "sort": {
        "time": "asc"
    }
}

 

SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
		sourceBuilder.query(query);
		sourceBuilder.collapse(new CollapseBuilder("userid.keyword"));
		sourceBuilder.from(pagesize * pageindex);
		sourceBuilder.size(pagesize);
		sourceBuilder.fetchSource(new String[] { "userid" }, new String[] {});
		sourceBuilder.sort("time", SortOrder.DESC);

  

常用 elasticsearch 查询 及 java 实现

标签:this   java   index   tor   like   elastic   key   highlight   color   

原文地址:https://www.cnblogs.com/merseyalma/p/12851901.html


评论


亲,登录后才可以留言!