Closed
Description
Hello,
I'm trying to figure out how to set a sort field when querying. I've looked at the tests, but can't figure out how they apply when dealing with multiple types. As near as I can tell all of the examples in SortUsageTests apply only to a single type.
To simplify things I decided to try sorting using DocumentIndexOrder:
var response = esClient.Search<object>(s => s
.From(request.from)
.Size(request.size)
.Index("matches")
.Type(Types.Type(typeof(TypeA), typeof(TypeB)))
.Query(q=>q
.QueryString(qs => qs.Query(request.query))
)
.Sort(ss=>ss
.Descending(SortSpecialField.DocumentIndexOrder)
)
);
This, however, throws an exception:
An exception of type 'Elasticsearch.Net.UnexpectedElasticsearchClientException' occurred in Elasticsearch.Net.dll but was not handled in user code
Additional information: Cannot implicitly convert type 'Newtonsoft.Json.Linq.JValue' to 'double'. An explicit conversion exists (are you missing a cast?)
What's the right way to sort by a field by Name in a multi-type situation?
What's the right way to sort by DocumentIndexOrder?
Many Thanks!
-D
Metadata
Metadata
Assignees
Labels
No labels