Geospatial FTS query result fields meanning


#1

Hi, I create a FTS index using geopoints. I´m using the travel-sample data and indexed geo field on hotel documents. Just like this documentation: https://developer.couchbase.com/documentation/server/current/fts/fts-geospatial-queries.html

But I would like to understand the fields I get when I do a search using CURL.
I´m doing this query:
curl -XPOST -H “Content-Type: application/json” http://localhost:8094/api/index/hotels/query -d ‘{ “from”: 0, “size”: 100, “query”: { “location”: { “lon”: -2.235143, “lat”: 53.482358}, “distance”: “100mi”, “field”: “geo”}, “sort”: [ { “by”: “geo_distance”, “field”: “geo”, “unit”: “mi”, “location”: { “lon”: -2.235143, “lat”: 53.482358 } } ] }’

And getting this result:

{
“facets”: null,
“hits”: [
{
“id”: “hotel_17413”, <- ID DOCUMENT; PERFECT
“index”: “hotels_4c00a9be0f17dead_aa574717”, <- Name FTS INDEX + some random id??
“score”: 0, <- What is this score? score of what?
“sort”: [
" \u0001?U]S\.e\u0002_" <- What is this string means???
]
},
{
“id”: “hotel_17414”,
“index”: “hotels_4c00a9be0f17dead_f4e0a48a”,
“score”: 0,
“sort”: [
" \u0001?Z\u0000./\u0007Q\u0012\t"
]
},
---- A LOT OF HOTELS ------
],
“max_score”: 1.871424787928491e-06,
“request”: {
“explain”: false,
“facets”: null,
“fields”: null,
“from”: 0,
“highlight”: null,
“includeLocations”: false,
“query”: {
“distance”: “100mi”,
“field”: “geo”,
“location”: [
-2.235143,
53.482358
]
},
“size”: 100,
“sort”: [
{
“by”: “geo_distance”,
“field”: “geo”,
“location”: {
“lat”: 53.482358,
“lon”: -2.235143
},
“unit”: “mi”
}
]
},
“status”: {
“failed”: 0,
“successful”: 6,
“total”: 6
},
“took”: 217693700,
“total_hits”: 166
}

Please, help.


#2

Hello Romero,

In your query result,

“id”: “hotel_17413”, <- ID DOCUMENT; PERFECT

Yes, you’re right, it is the document key/id.

“index”: “hotels_4c00a9be0f17dead_aa574717”, <- Name FTS INDEX + some random id??

Indeed, it refers to which pindex the document can be found in. By default, every index is partitioned into 6 pindexes that are distributed across the fts nodes in your cluster. This is the pindex identifier.

"score”: 0, <- What is this score? score of what?

Every document has a relevance score. It is usually a number used to rank documents that match the query based on tf-idf method of scoring.

“sort”: [" \u0001?U]S\.e\u0002_" ] <- What is this string means???

In general, sort field contains the list of terms of the field a document is sorted by. In your query, it is the geo-distance calculated per document based on the location in the query.

Thanks
Aruna