Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/asp.net-mvc-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 为什么使用NEST的自定义分析器的排序嵌套ElasticSearch返回无效结果?_C#_<img Src="//i.stack.imgur.com/RUiNP.png" Height="16" Width="18" Alt="" Class="sponsor Tag Img">elasticsearch_Nest - Fatal编程技术网 elasticsearch,nest,C#,elasticsearch,Nest" /> elasticsearch,nest,C#,elasticsearch,Nest" />

C# 为什么使用NEST的自定义分析器的排序嵌套ElasticSearch返回无效结果?

C# 为什么使用NEST的自定义分析器的排序嵌套ElasticSearch返回无效结果?,c#,elasticsearch,nest,C#,elasticsearch,Nest,使用elasticSearch v6.2.4,我希望根据HMI中的用户选择对结果进行排序 这对于我的SearchableCondition中的大多数元素来说都是成功的,但对于涉及血管的成员来说却不是 我对ES还很陌生,读了很多关于查询和排序等可能的变体的文章后,我觉得有点不知所措 课程的简短版本: public class SearchableSituation : IEquatable<SearchableSituation> { //Other members p

使用elasticSearch v6.2.4,我希望根据HMI中的用户选择对结果进行排序

这对于我的SearchableCondition中的大多数元素来说都是成功的,但对于涉及血管的成员来说却不是

我对ES还很陌生,读了很多关于查询和排序等可能的变体的文章后,我觉得有点不知所措

课程的简短版本:

public class SearchableSituation : IEquatable<SearchableSituation>
{
    //Other members
    public IEnumerable<SearchableInvolvedVessel> InvolvedVessels { get; set; }
}
}

我正在尝试将我的查询构建为:

var sortedResult = await _client.SearchAsync<SearchableSituation>(s => s
.Index(_situationIndexer.IndexName)
.From(message.Query.SearchResultsFrom)
.Size(message.Query.SearchResultsSize)
.Sort(sort => sort.Ascending(f => f.Status)
    .Field(x => x.Nested(y => y.Path(p => p.InvolvedVessels))
        .Field(v => v.InvolvedVessels.First().VesselName.Suffix("keyword"))
        .Field("name.singleTerm")
        .Order(sortOrder)))
.Query(q => q
    .Bool(m => m
        .Must(queries))));
我尝试了许多不同的路径、字段和后缀选项,但没有成功,我开始觉得有点卡住了


有人能告诉我哪里出了问题吗?

所以,在VesselName映射中添加一个额外的字段会产生一个有效的结果

.Text(t => t
.Name(nn => nn.VesselName)
.Fields(f => f
    .Text(tk => tk
        .Name("singleTerm") //adding sub-field with keyword analyzer to index 'Name' property to include single term search when using phrase_prefix queries.
        .Analyzer("keywordWithCaseIgnore"))//))
    .Keyword(k => k          //<--- These two lines
        .Name("keyword"))))  //<---

您能否包括来自
sortedResult.DebugInformation
的详细信息?应该包含关于错误本身的更多详细信息。更新了post@Rob
var sortedResult = await _client.SearchAsync<SearchableSituation>(s => s
.Index(_situationIndexer.IndexName)
.From(message.Query.SearchResultsFrom)
.Size(message.Query.SearchResultsSize)
.Sort(sort => sort.Ascending(f => f.Status)
    .Field(x => x.Nested(y => y.Path(p => p.InvolvedVessels))
        .Field(v => v.InvolvedVessels.First().VesselName.Suffix("keyword"))
        .Field("name.singleTerm")
        .Order(sortOrder)))
.Query(q => q
    .Bool(m => m
        .Must(queries))));
Invalid NEST response built from a unsuccessful low level call on POST: /situationsindex/searchablesituation/_search?typed_keys=true # Audit trail of this API call: - [1] BadResponse: Node: http://localhost:9200/ Took: 00:00:00.0030001 # OriginalException: System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Elasticsearch.Net.HttpConnection.d__14`1.MoveNext() in C:\Users\russ\source\elasticsearch-net-master\src\Elasticsearch.Net\Connection\HttpConnection.cs:line 242 # Request: # Response: 
.Text(t => t
.Name(nn => nn.VesselName)
.Fields(f => f
    .Text(tk => tk
        .Name("singleTerm") //adding sub-field with keyword analyzer to index 'Name' property to include single term search when using phrase_prefix queries.
        .Analyzer("keywordWithCaseIgnore"))//))
    .Keyword(k => k          //<--- These two lines
        .Name("keyword"))))  //<---
.Sort(sort => sort.Ascending(f => f.Status)
.Field(x => x.Nested(y => y.Path(p => p.InvolvedVessels))
    .Field(v => v.InvolvedVessels.First(iv => iv.IsRiskRole).VesselName.Suffix("keyword"))
    .Order(sortOrder)))
.Query(q => q
.Bool(m => m
    .Must(queries))));