Elasticsearch.Net 异常:[match] query doesn't support multiple fields, found [field] and [query]
用Elasticsearch.Net检索数据,报异常:
var settings = new ConnectionConfiguration(new Uri("http://localhost:9200")).RequestTimeout(TimeSpan.FromMinutes());
ElasticLowLevelClient client = new ElasticLowLevelClient(settings);
var searchResponse = client.Search<StringResponse>("test", "Person", PostData.Serializable(new
{
from = ,
size = ,
query = new { match = new { field = "name", query = "chenzongyan" }}
}));
string body = searchResponse.Body;
Console.WriteLine(body);
Console.ReadKey();
异常信息:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "[match] query doesn't support multiple fields, found [field] and [query]",
"line": ,
"col":
}
],
"type": "parsing_exception",
"reason": "[match] query doesn't support multiple fields, found [field] and [query]",
"line": ,
"col":
},
"status":
}
解决办法:
var searchResponse = client.Search<StringResponse>("test", "Person", PostData.Serializable(new
{
from = 0,
size = 10,
query = new
{
multi_match = new
{
fields = "name",
query = "chenzongyan"
}
}
}));
将match 改为 multi_match ,field改为fields.
检索结果:
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 1,
"max_score": 0.2876821,
"hits": [
{
"_index": "test",
"_type": "Person",
"_id": "WOgCs2UBfhVuaFPoccea",
"_score": 0.2876821,
"_source": {
"name": "chenzongyan",
"Age": 27
}
}
]
}
}
参考:https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/elasticsearch-net-getting-started.html
Elasticsearch.Net 异常:[match] query doesn't support multiple fields, found [field] and [query]的更多相关文章
- ES query does not support [auto_generate_synonyms_phrase_query]
测试环境使用 elasticsearch-rest-high-level-client 做为基础包发起es调用出现如下异常: {"error":{"root_caus ...
- elasticsearch 查询(match和term)
elasticsearch 查询(match和term) es中的查询请求有两种方式,一种是简易版的查询,另外一种是使用JSON完整的请求体,叫做结构化查询(DSL). 由于DSL查询更为直观也更为简 ...
- (转载)elasticsearch 查询(match和term)
原文地址:https://www.cnblogs.com/yjf512/p/4897294.html elasticsearch 查询(match和term) es中的查询请求有两种方式,一种是简易版 ...
- SpringBoot启动使用elasticsearch启动异常:Received message from unsupported version:[2.0.0] minimal compatible
SpringBoot启动使用elasticsearch启动异常:Received message from unsupported version:[2.0.0] minimal compatible ...
- MongoDB - MongoDB CRUD Operations, Query Documents, Project Fields to Return from Query
By default, queries in MongoDB return all fields in matching documents. To limit the amount of data ...
- MongoDB - MongoDB CRUD Operations, Query Documents, Query for Null or Missing Fields
Different query operators in MongoDB treat null values differently. The examples on this page use th ...
- 使用elasticsearch启动项目报错failed to load elasticsearch nodes 。。。。。No type specified for field [name]
failed to load elasticsearch nodes .....No type specified for field [name]翻译: 加载ElasticSearch节点失败... ...
- Elasticsearch 报错:Fielddata is disabled on text fields by default. Set `fielddata=true` on [`your_field_name`] in order to load fielddata in memory by uninverting the inverted index.
Elasticsearch 报错: Fielddata is disabled on text fields by default. Set `fielddata=true` on [`your_fi ...
- Elasticsearch搜索异常-------org.elasticsearch.common.io.stream.NotSerializableExceptionWrapper: parse_exception
异常问题: Caused by: org.elasticsearch.index.query.QueryShardException: Failed to parse query [LOL: Uzi和 ...
随机推荐
- DataFrame 加减乘除
headlist = ['a', 'b'] datalist = [[1, 2], [0,3], [3,2]] df = pd.DataFrame(data=datalist,columns=head ...
- .Net Core应用程序发布时不同方式的差别
.Net Core的文档更新的真是快..每次看的时候都觉得之前是不是梦游看的...每次发布应用程序的时候都要翻看下文档..至少rid是死活记不住.还是留个RID的索引吧..还有发布的索引 ,这样就好复 ...
- CC2640R2F&TI-RTOS 拿到 TI CC2640R2F 开发板 第一件事就是移植串口驱动,重定向 printf
/* * board_uart.c * * Created on: 2018年7月3日 * Author: admin */ #include "board_uart.h" #in ...
- 【腾讯敏捷转型No.7】QQ邮箱如何通过敏捷成为行业第一
前几篇文章讲到2006年的腾讯是如何开始敏捷转型的,接下来这篇文章,我将向大家讲述,腾讯开始敏捷转型之后,QQ邮箱是如何通过敏捷成为行业第一. 众所周知,张小龙是“微信之父”,对他熟悉的人,应该也知道 ...
- 苹果IPad客户端安装测试软件
背景: 公司在开发一个App应用,需要部署在苹果IPad上进行测试,但是我负责后端开发对安装及测试相关流程不了解.经过一番学习得出以下结论: 1. 首先申请一个苹果的开发账号(一千块左右),大约能注册 ...
- Druid手动设置参数错误
在做Druid操作的时候,出现了小错误:但是总归是找到了,并且推一及三,以后学者高效解决问题: 严重: create connection errorjava.sql.SQLException: Ac ...
- Storm相关笔记(包括Kafka和HBase)
一.Apache Kafka 1.了解Kafka 1.1.Kafka是什么?有什么用? 是什么? 1) Apache Kafka 是一个消息队列(生产者消费者模式) 2) Apache Kafka 目 ...
- mongo数据集合属性中存在点号(.)
基本知识点: 1.似乎mongo3.6之前不允许插入带点(.)或美元符号($)的键,但是当我使用mongoimport工具导入包含点的JSON文件时,它工作正常. 2.在使用spring-data-m ...
- python自学之第一章——列表(一)
1.列表是什么? 列表[list]:列表是由一系列特定顺序排列的元素组成. 列表由[]表示 eg: a = ['jackal','jax';'jack','jeef','jacky'] print(a ...
- Python学习 :面向对象(一)
面向对象 一.定义 面向对象:面向对象为类和对象之间的应用 class + 类名: #在类中的函数称作 “方法“ def + 方法名(self,arg): #方法中第一个参数必须是 self prin ...