Skip to main content

Geo and Vector Queries

Search for documents based on geographic location or vector similarity.

Geo Queries

Geo Distance Query

Returns documents that fall within a specified distance from a central geo point. Useful for location-based searches like "find stores near me".

{
"query": {
"geo_distance": {
"distance": "10km",
"location": {
"lat": 40.7128,
"lon": -74.0060
}
}
}
}

Alternative coordinate formats:

{
"query": {
"geo_distance": {
"distance": "5mi",
"location": "40.7128,-74.0060"
}
}
}

Geo Bounding Box Query

Returns documents with geo points that fall within a rectangular geographic area defined by top-left and bottom-right coordinates.

{
"query": {
"geo_bounding_box": {
"location": {
"top_left": {
"lat": 40.8,
"lon": -74.1
},
"bottom_right": {
"lat": 40.7,
"lon": -74.0
}
}
}
}
}

Infino supports vector search for AI/ML applications using k-nearest neighbors (KNN).

KNN Query

Returns the k-nearest neighbors to a query vector using similarity search. Essential for semantic search, recommendations, and AI-powered applications.

{
"query": {
"knn": {
"embedding_field": {
"vector": [0.1, 0.2, 0.3, 0.4],
"k": 10
}
}
}
}

Advanced KNN with filtering:

{
"query": {
"knn": {
"embedding_field": {
"vector": [0.1, 0.2, 0.3, 0.4],
"k": 10,
"filter": {
"term": {"status": "published"}
}
}
}
}
}

Supported parameters:

  • vector - The query vector (array of floats)
  • k - Number of nearest neighbors to return
  • filter - Pre-filter documents before vector search
  • boost - ⚠️ Accepted but ignored