我有以下弹性搜索查询:
{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "main",
"type": "cross_fields",
"fields": [
"field1^5",
"test",
"field2",
"abc"
],
"operator": "and"
}
}
}
},
"sort": [],
"from": 0,
"size": 20
}
我正在尝试使用 NEST 客户端进行弹性搜索并使用“ QueryRaw ”属性运行此查询,但出现错误。
有人可以在我出错的地方提供一些输入吗
var uri = new Uri("Elastic_Search_Cluster_Name");
var settings = new ConnectionSettings(uri, defaultIndex: "testIndex");
var client = new ElasticClient(settings);
var resp=client.Search<dynamic>(q =>
q.Type("mappingType").QueryRaw(inputRequest.ToString())
);
错误日志:
Failed to execute phase [query], all shards failed; shardFailures {[27THF3S_QuaBLRj11MgqfA][testIndex][0]: RemoteTransportException[[pdm64-ironman][inet[/server]][indices:data/read/search[phase/query]]]; nested: SearchParseException[[testIndex][0]: query[abc:main field2:main test:main field1:main^5.0],from[-1],size[-1]: Parse Failure [Failed to parse source [{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "main",
"type": "cross_fields",
"fields": [
"field1^5",
"test",
"field2",
"abc"
],
"operator": "and"
}
}
},
"sort": [],
"from": 0,
"size": 20
}
}]]]; nested: ElasticsearchParseException[Expected field name but got START_ARRAY "sort"]; }{[b5YxyDCcQEmSlCd9y3Sfww][testIndex][1]: RemoteTransportException[[pdm65-hulk][inet[/server]][indices:data/read/search[phase/query]]]; nested: SearchParseException[[testIndex][1]: query[abc:main field2:main test:main field1:main^5.0],from[-1],size[-1]: Parse Failure [Failed to parse source [{
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "main",
"type": "cross_fields",
"fields": [
"field1^5",
"test",
"field2",
"abc"
],
"operator": "and"
}
}
},
"sort": [],
"from": 0,
"size": 20
}
}]]];