I'm previewing AppSearch engine based on existing Elasticsearch indices, got a weird value in sort
field in search result.
The way to reproduce it:
- Put some docs into the index
POST search-books/_doc
{
"name": "Elasticsearch Guide",
"sort": 9,
"version": 8.2,
"price": 49
}
POST search-books/_doc
{
"name": "Kubernetes in Action",
"sort": 4,
"version": 1.24,
"price": 99
}
-
Create a AppSearch engine (based on Elasticsearch v8.2.3) named books-engine by choosing existing index search-books
-
Browse the documents via your Kibana panel (/app/enterprise_search/app_search/engines/books-engine/documents)
or via API
POST /api/as/v1/engines/books-engine/search
{"query": ""}
The return result is
{
"meta" : {
"engine" : {
"name" : "books-engine",
},
"page" : {
// omit some fields ...
},
"request_id" : "fJidGnLUQuCUKbFePr7qOQ"
},
"results" : [
{
"id" : {
"raw" : "Ghbh24EBlMLi8pstBRpx"
},
"name" : {
"raw" : "Kubernetes in Action"
},
"price" : {
"raw" : 99
},
"version" : {
"raw" : 1.24
},
"sort" : {
"raw" : [
1,
1
]
}
},
{
"id" : {
"raw" : "n9Lg24EBzZcm6zCt_OEm"
},
"name" : {
"raw" : "Elasticsearch Guide"
},
"version" : {
"raw" : 8.2
},
"price" : {
"raw" : 49
},
"sort" : {
"raw" : [
1,
0
]
}
}
]
}
As you can see, the sort.raw value is an array instead of a number.
Can someone explain why this happened and how to avoid it?