Commit Graph

90 Commits

Author SHA1 Message Date
Kumar Shivendu
83af9cf3ba Improve telemetry logic and test (#6399)
* Improve telemetry logic and test

* Parametrize telemetry test

* Consistency hash peeer ID across telemetry

* clean test

* Use Option in segments telemetry

* updat openapi spec

* Avoid test failure on change in order of params
2025-04-21 00:12:26 +02:00
Andrey Vasnetsov
bbea80e7d4 Telemetry improvements (#6390)
* allow shard states in anonymize telemetry (with hashed peer ids)

* introduce level3 and level4 for telemetry, where level4 = everything, incl. segments info

* upd openapi

* fix tests

* expose vector count & size stats on shard level to avoid reading of segments

* fix spelling

* upd schema

* fix tests

* Use unwrap_or_default

* [#6390] skip serializing shard details in Level2 (#6398)

* skip serializing shard details in Level2

* upd openapi

---------

Co-authored-by: generall <andrey@vasnetsov.com>

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Luis Cossío <luis.cossio@qdrant.com>
2025-04-21 00:10:28 +02:00
Luis Cossío
156c79ebdc [query api] don't propagate offset into prefetches (#6357)
* don't propagate offset into prefetches

* I want to see CI with that change

* Move import into platform specific scope

* edit test to make sure offset is not propagated

* fix planned query test

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
Co-authored-by: timvisee <tim@visee.me>
2025-04-20 23:59:01 +02:00
Arnaud Gourlay
b1b27c088a Fix strict mode query limit for distance matrix API (#6354) 2025-04-20 23:58:02 +02:00
Arnaud Gourlay
e4400c6051 Fix strict mode query limit for group APIs (#6353) 2025-04-20 23:55:48 +02:00
Arnaud Gourlay
841048bbd2 Read rate limiter charge per filter condition (#6333) 2025-04-20 23:53:17 +02:00
Arnaud Gourlay
db7dcda044 Rate limit retrieve based on number of ids (#6327)
* Rate limit retrieve based on number of ids

* fmt

* Better test
2025-04-20 23:52:54 +02:00
Luis Cossío
317f1e0dbe [strict mode | score boosting] Strict mode for formula queries (#6317)
* move problems.rs to collection crate

* change type on datetime_key expression

* extract from expression

* check for unindexed fields in formula

* clippy

* dedup code

* Only implement verification for `CollectionQuery` types (#6319)

* verify CollectionQuery's Prefetch

* remove implementation for REST query

* remove implementation for REST query groups

* add basic openapi test
2025-04-20 23:52:36 +02:00
Arnaud Gourlay
6e2191fcae Document Multivector Euclidean scoring discrepancy (#6320) 2025-04-20 23:52:28 +02:00
Arnaud Gourlay
6518a053c9 Rate limite recommendation based on number of examples (#6324) 2025-04-20 23:52:11 +02:00
Andrey Vasnetsov
1bbe483877 decrease collection probability (#6224) 2025-03-31 16:17:46 +02:00
Luis Cossío
0184e2d390 [score boosting] Error on unexpected type (#6187)
* helper for getting payload value

* Error instead of silent default

* fix clippy

* fix openapi test
2025-03-21 11:45:42 +01:00
Arnaud Gourlay
f5e35f9805 Write rate limit batch update per point count (#6152) 2025-03-21 11:43:26 +01:00
Arnaud Gourlay
aa10df0fe4 Unset strict config fields (#6120) 2025-03-21 11:42:46 +01:00
Andrey Vasnetsov
706b1a3166 IsEmpty/IsNull index (#6088)
* create initial strucutres

* clippy

* start field-query refactoring

* start field-query refactoring (2/N)

* start field-query refactoring (3/N): duplicate is_empty/null condiftions as field condition

* start field-query refactoring (4/N): re-instate is_empty fallback in case new index is not built yet

* filter for is_empty/is_null

* implement add/remove point

* upd schema

* open and create of null-index

* create null-index

* fix test

* Update lib/segment/src/index/query_optimization/condition_converter.rs

Co-authored-by: Tim Visée <tim+github@visee.me>

* unit test for null-index

* more unit tests

* add openapi tests

* fmt

* fix for integartion tests

* rabbit review fix

* make [null] non-empty

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-03-21 11:41:12 +01:00
Luis Cossío
1a23ebc4b9 [score boosting] openapi test for formula (#6064)
* add formula to internal grpc api

* add openapi test for formula
2025-03-21 11:40:07 +01:00
Arnaud Gourlay
cb1f3220df Add strict mode for max points count (#5967)
* Add strict mode for max points count

* clarify estimated nature
2025-02-17 10:20:50 +01:00
Arnaud Gourlay
27d5b39aee Retry-After on rate limiter hit for REST API (#5917)
* Retry-After on rate limiter hit for REST API

* fix tests

* Ceil retry after seconds number so clients don't retry too early

* Relax retry after time requirement a bit in case CI machines are slow

* Add rate limit test, test retry after if we replanish within a second

* Report time to wait in rate limit error

---------

Co-authored-by: timvisee <tim@visee.me>
2025-02-11 14:41:44 +01:00
n0x29a
00933d07ae Strict mode sparsevector (#5841)
* Strict mode sparse vectors
* Update gRPC docs
* Use deny_unknown_fields (#5868)

---------

Co-authored-by: n0x29a <n0x29a@example.com>
Co-authored-by: timvisee <tim@visee.me>
Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2025-01-27 18:25:34 +01:00
Arnaud Gourlay
0140eb83fc Strict mode multivector (#5757)
* strict mode for multivector

* simplify impl

* regen docs
2025-01-23 14:28:01 +01:00
Arnaud Gourlay
6678050332 API validation for unique dense and sparse vector names (#5808)
* API validation for unique dense and sparse vector names

* less alloc

* test empty name as well

* quotes instead of ticks
2025-01-16 10:52:00 +01:00
Arnaud Gourlay
bd882fde54 Migrate strict mode payload test for mmap (#5793) 2025-01-16 10:50:46 +01:00
Jojii
b870f96513 [Strict mode] limits for filter and conditions (#5754)
* Add limits for filter and conditions

* clippy

* Review remarks + nested condition test

* Fix opnapi specs

* Improve error message by giving info about limits and usage
2025-01-16 10:50:36 +01:00
Jojii
cb8667a7ae Merge pull request #5729
* Consider filter-cardinality as cost in update ratelimiter

* Use OperationEffectArea and improve rate limit error message

* Clippy

* Fix test
2025-01-16 10:49:14 +01:00
Arnaud Gourlay
3d3f8c104e Reshape read rate limiter and fix disabled mode (#5683) 2025-01-08 14:08:41 +01:00
Arnaud Gourlay
d3f2b8e79c Fix rate limiting of internal update operations (#5653)
* Fix rate limiting of internal update operations

* code review

* write_rate_limiter turned Option<Mutex> and fix disabling mode

* Update TODO tag

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
2025-01-08 14:08:29 +01:00
Arnaud Gourlay
947e79e054 Strict mode for payload storage (#5588)
* Strict mode for payload storage

* Don't increment counter multiple times per request

* Add (loose) integration tests for payload storage limit

* Minor improvements

* minor renaming

* Update lib/api/src/grpc/proto/collections.proto

Co-authored-by: Tim Visée <tim+github@visee.me>

---------

Co-authored-by: jojii <jojii@gmx.net>
Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
Co-authored-by: Tim Visée <tim+github@visee.me>
2025-01-08 14:07:24 +01:00
Arnaud Gourlay
993121b3ea Rate limit requests per minute (#5597)
* Rate limit requests per minute

* rename to remove time unit for API
2025-01-08 14:01:28 +01:00
Arnaud Gourlay
3c19eea9ca Rate limiting for shard operations (#5582)
* Rate limiting for shard operations

* address all review comments in one go
2024-12-09 11:18:50 +01:00
Jojii
0702854477 Strict mode max collection vector size (#5501)
* Strict mode config: Max collection size

* api specs

* Add tests + set/update payload check

* Improve function names and add comments

* rename config to separate vectors and payload

* fix tests

* Adjust configs docs

* add benchmark

* improve performance by caching shard info

* add bench for size_info() and fix tests

* Also limit the batch-size for vector updates (#5508)

* Also limit the batch-size for vector updates

* clippy

* add lost commit

* Load cache on collection initialization

* add unit type to parameter name

* fix renaming in test

* clearer error message

* fix test

* review remarks

* remove unused function for now

---------

Co-authored-by: Arnaud Gourlay <arnaud.gourlay@gmail.com>
2024-12-09 11:18:33 +01:00
Tim Visée
4e13a76540 Fix panic on query with huge limit (#5484)
* Limit maximum preallocation on search results aggregator hash set

Prevents an allocation failure and panic if a user specifies a huge
search limit.

* Prevent overflow on fixed length priority queue limit with u64::MAX

* Fix overflow with high limit in search API

* Add two basic tests covering high search limit
2024-12-09 10:48:52 +01:00
Jojii
7b83223c8c Add max upsert batch size strict mode option (#5485) 2024-12-09 10:48:49 +01:00
Predrag Knezevic
96a5a2bce8 Test collections unique per openapi test module (#5384)
Collection name under test is equal to the test module name, without `.py` suffix.

* Helps by debugging/tracing failed tests and find relevant logs lines in qdrant log files
* Opens up a possibility to run tests in parallel, given that there are no data sharing
  between test modules

Change details:
* defined module scoped `collection_name` fixture in `conftest.py`
* removed `collection_name` module variable
* each test signature modified to declare the dependency to `collection_name` fixture
* `@pytest.mark.parametrize` migrated to `@pytest-cases.parametrize` in cases when
  `collection_name` was used as the value
2024-11-08 11:27:05 +01:00
Predrag Knezevic
f57046daef Retry collection delete in test teardown (#5364)
Although test logic passes the assertions, the test might fail
if during the teardown the created collection is not deleted,
because the client could not reach the database due to networking issue.

In order to make test executions more robust, collection deletes
are retried in case of networking issues.
2024-11-08 11:25:04 +01:00
Tim Visée
90696530f5 Fix immutable map index mishandling point deletions (#5346)
* Fix search and delete using subslice index, rather than container intex

* Add sanity checks in debug assertions

* test

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-11-08 11:21:45 +01:00
Predrag Knezevic
ef9cbabb4c Add wait=true in openapi test for all point delete calls transparently (#5348)
If `wait=true` param is not set for delete vector API calls, a test asserting later
that data are gonna can become flaky, because at the assertion time the data could be
still there.

The following files contain such tests at the moment:
* `test_multi_vector_uint8.py`
* `test_multi_vector.py`
* `test_multi_vector_unnamed.py`
* `test_optional_vectors.py`

In order to fix these and prevent the flakiness of future test,
`request_with_validation` helper add `wait=true` param, if it is not set
for delete vector calls.
2024-11-08 11:21:42 +01:00
Predrag Knezevic
6f23975e3e Enable running integration tests against non-localhost available instance (#5345)
* `QDRANT_HOST` variable is used by all openapi tests, removed its copies from
  `test_multi_vector_uint8.py`, `test_multi_vector_unnamed.py`, `test_query.py`,
  `test_shard_snapshot.py`, and `test_snapshot.py`
* Added optional `QDRANT_HOST_HEADERS` env variable to set custom HTTP headers
  in order to reach Qdrant instance behind a reverse proxy. The content of the
  variable is JSON payload, e.g. `{"host": "qdrant.local"}`
* Adapted `./tests/basic_*.sh` scripts to aware of `QDRANT_HOST_HEADERS` env variable
2024-11-08 11:21:36 +01:00
Andrey Vasnetsov
bcf05d9e23 HasVector filtering condition (#5303)
* include vector storage into struct vector index

* implement has_vector

* generate schemas

* refactor query filter optimizer so avoid too many function arguments

* test + fix for sparse vectors

* Update lib/segment/src/index/struct_payload_index.rs

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

* Update lib/segment/src/index/query_optimization/optimizer.rs

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>

* fmt

---------

Co-authored-by: Jojii <15957865+JojiiOfficial@users.noreply.github.com>
2024-11-08 11:17:37 +01:00
Jojii
a0de9509d7 Add strict mode config to update collection API + Populate strict mode in API (#5187)
* add strict mode to update collection API

* update API specs

* clippy

* Update lib/storage/src/content_manager/toc/collection_meta_ops.rs

* Strict mode integration tests (#5189)

* Add integration tests for strict mode

* add full update test

* Apply suggestions from code review

Co-authored-by: Tim Visée <tim+github@visee.me>

* Adjust error messages

* improve checking of error response

---------

Co-authored-by: Tim Visée <tim+github@visee.me>

* prefer explicit structu conversion

---------

Co-authored-by: Tim Visée <tim+github@visee.me>
Co-authored-by: generall <andrey@vasnetsov.com>
2024-11-08 10:59:32 +01:00
Jojii
9690ba6cb6 Add error handling if vector is missing for point (#5211)
* add error handling for missing vectors

* add integration test

* add call without specifying 'using' parameter
2024-11-08 10:57:54 +01:00
Luis Cossío
ad6b9734f3 Facets: Support for bool payload (#5100)
* enable faceting with boolean index

* test and fix

* also test uuid
2024-10-08 13:11:36 +02:00
tellet-q
dea45cb5ab Add tests on uuid payload index queries with filters (#4971)
* Add on_disk:True for uuid index schema check

* Add tests for uuid payload index

* Fix test

* Add test comparing filtered queries between keyword index and uuid index

* Remove order by case

* Clean up
2024-08-29 15:24:25 +02:00
Luis Cossío
ace8a90259 Facets in REST (#4848)
* rename to FacetRequestInternal

* add rest endpoint

* fix correctness by fetching the whole list of values

* fix mmap map index variant

Also removes test for sorted output, for now

* add ytt spec

* fix clippy

* use hashmap inside of local shard

* rename operation to `facet`, add access test

* whitelist endpoint

* change api

* make limit optional
2024-08-27 01:08:53 +02:00
Arnaud Gourlay
faab853b86 Search distance matrix REST API (#4884)
* Search distance matrix REST API

* apply Validator upgrade

* min sample size is 2 thanks Luis

* review: rethink pair view

* remove rows-based similarity matrix output

* fmt

* upd openapi

* we have only 70 apis now

---------

Co-authored-by: generall <andrey@vasnetsov.com>
2024-08-27 01:06:50 +02:00
Arnaud Gourlay
29126883bc Update Validator 0.18 (#4894)
* Update Validator 0.18

* fix new test error message

* clearer geo error message

* fix error message

* fix unit tests

* Put spaces back

---------

Co-authored-by: timvisee <tim@visee.me>
2024-08-27 01:04:34 +02:00
xzfc
0951aa5982 Test payload schemas (#4822)
* test: don't parametrize test_payload_indexing.py with on_disk_vectors

* test: add test_payload_schemas()
2024-08-09 18:18:09 +02:00
xzfc
f225e5865a chore: move tests/openapi/openapi_integration/* → tests/openapi/* (#4820) 2024-08-09 18:17:44 +02:00
Natanael Mojica
330eae8529 Refactor: Convert app and cluster info metrics from counters to gauges #4696 (#4733)
* Refactor: Convert app and cluster info metrics from counters to gauges

- Change app_info, app_status_recovery_mode, and cluster_enabled metrics from COUNTER to GAUGE
- Update metric values to use boolean as f64 for consistency and clarity
- Improve metric type accuracy for better representation of state information

* fix: Update docs regarding metrics type

* openapi: Update app_info metric type

* metrics: Update test to check for the right metric type
2024-08-09 18:11:35 +02:00
Luis Cossío
f64432686e universal-query: Expose random sampling query (#4657)
* expose random sampling query

* fix random query rescoring

* only ignore offset when there are no prefetches

* fix offset and with_payload/with_vector

* gen grpc docs

* make tests less flaky

* gen openapi schema

* Remove suffixed spaces

---------

Co-authored-by: timvisee <tim@visee.me>
2024-08-09 18:10:37 +02:00
Arnaud Gourlay
6a672d3aec universal-search: Query group API should support lookup_from (#4706)
* universal-search: Query group API should support lookup_from

* sync docs
2024-08-09 18:09:51 +02:00