NEST search查询
/// <summary>
/// GET /megacorp/employee/_search
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryDoc()
{
var response = client.Search<employee>();
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
} /// <summary>
/// GET /megacorp/employee/_search
/// queryMatch
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryMatchDoc()
{
var response = client.Search<employee>(s =>
s.Query(
q => q.Match(m => m.Field(f => f.last_name).Query("明狮"))
));
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
} /// <summary>
/// GET /megacorp/employee/_search
/// queryBool
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryBoolDoc()
{
var response = client.Search<employee>(s =>
s.Query(
q => q.Bool(
b => b.Must(m => m.Match(mm => mm.Field(f => f.last_name).Query("小明")))
.Filter(f => f.Range(r => r.Field(ff => ff.age).GreaterThan(20)))
)));
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
} /// <summary>
/// GET /megacorp/employee/_search
/// queryMatchPhrase
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryMatchParseDoc()
{
var response = client.Search<employee>(s =>
s.Query(
q => q.MatchPhrase(m => m.Field(f => f.last_name).Query("小明"))));
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
} /// <summary>
/// GET /megacorp/employee/_search
/// queryHighlight
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryHighLightDoc()
{
var response = client.Search<employee>(s =>
s.Query(
q => q.MatchPhrase(m => m.Field(f => f.last_name).Query("狮")))
.Highlight(h => h.Fields(ff => ff.Field(fff => fff.last_name))));
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
} /// <summary>
/// GET /megacorp/employee/_search
/// queryAggregations
/// </summary>
/// <returns></returns>
public ISearchResponse<employee> QueryAggsDoc()
{
var response = client.Search<employee>(s => s.Aggregations(a => a.Terms("ages", t => t.Field(f => f.age))));
Console.WriteLine(JsonConvert.SerializeObject(response));
return response;
}
NEST search查询的更多相关文章
- NEST - 编写查询
Writing queries Version:5.x 英文原文地址:Writing queries 将数据索引到了 Elasticsearch 之后,就可以准备搜索它们了.Elasticsearch ...
- day 68crm(5) 分页器的进一步优化,以及在stark上使用分页器,,以及,整理代码,以及stark组件search查询
前情提要: 本节内容 自定制分页器 保存及查询记录 代码整理, stark组件search 查询 一:自定制分页器 page 1:创建类 Pagination # 自定制分页器 _ _init ...
- elastic search查询命令集合
Technorati 标签: elastic search,query,commands 基本查询:最简单的查询方式 query:{"term":{"title" ...
- django-admin 仿写stark组件action,filter筛选过滤,search查询
写在StandLi里面的方法都是通过ModelSubject这个类里面的stand_li方法,在它里面用StandLi这个类实例化出来一个对象,这个实例化出来的对象把数据传给前端HTML模板进行渲染, ...
- elastic search 查询
eelastic search主要有两种查询方式,一种是查询字符串,一种是请求体(json格式)查询. 查询字符串: 查询字符串的功能相对简单,使用容易. 比如GET http://localhost ...
- Elasticsearch URI search 查询语法整理
Elasticsearch URI search 一.请求体查询与空查询 1. 请求体查询(request body search) 简单查询语句(lite)是一种有效的命令行adhoc查询.但是,如 ...
- Lucene add、updateDocument添加、更新与search查询(转)
package com.lucene; import java.io.IOException; import org.apache.lucene.analysis.standard.Stand ...
- elastic search 查询语句
部署了半个月,分析一下数据: 需要提前知道的是,tpot中,每天的数据存一个index,然后每个index里面有不同的type,每条请求一个document 共24万条请求: 查看整个集群所有数据 以 ...
- URL Search查询
#基本查询 GET /movies/_search?q=2012&df=title&sort=year:desc&from=0&size=10&timeout= ...
随机推荐
- Java后台读取excel表格返回至Web前端
如果是做连接数据库的话,系统难度就降低了不少:这次本人也算是体会到数据库的方便了吧(不过以后云储存好像会更受欢迎些):比如说查询列出所有数据吧:数据库每个表每一列都有列名,正常的做法是遍历数据库表,d ...
- PhpStorm 设置自动FTP同步文件
1.添加一个FTP服务器 ① 首先在这里打开添加FTP的页面,步骤,工具栏 -> Tools -> Deployment -> Configuration . ②添加服务器 ...
- sklearn逻辑回归(Logistic Regression,LR)调参指南
python信用评分卡建模(附代码,博主录制) https://study.163.com/course/introduction.htm?courseId=1005214003&utm_ca ...
- 013-centos7 常用命令--查看当前用户的4种方法
一.概述 4种查看系统用户信息(通过编号(ID))的方法. 1.1. 使用w命令查看登录用户正在使用的进程信息 w命令用于显示已经登录系统的用户的名称,以及他们正在做的事.该命令所使用的信息来源于/v ...
- [LeetCode] 774. Minimize Max Distance to Gas Station 最小化加油站间的最大距离
On a horizontal number line, we have gas stations at positions stations[0], stations[1], ..., statio ...
- ingress Whitelisting白名单机制
Whitelisting To restrict the service in a way that only a list of IPs can access it, modify the ingr ...
- Linux交换分区内存优化
swappiness的值的大小对如何使用swap分区是有着很大的联系的.swappiness=0的时候表示最大限度使用物理内存,然后才是 swap空间,swappiness=100的时候表示积极的使用 ...
- 悬架的灵魂——K&C特性
静止便是死亡,只有运动才能敲开永生的大门 — 泰戈尔 KC特性是车辆操控稳定性的直接影响者!可以分为 K ( Kinematic) 特性和 C( Compliance) 特性: K 特性即悬 ...
- QT QML与C++混搭
"那些杀不死我的必使我更加强大"----尼采 QML与C++混合编程就是使用QML高效便捷地构建UI,而C++则用来实现业务逻辑和复杂算法. ML访问C++Qt集成了QML引擎和Q ...
- select2的使用
普通的select不支持搜索,当选项很多的时候,需要一个个下拉查找. 有了select2就方便多了 下载 <https://select2.org/> 引入 <link href=& ...