-
-
Save kishorenc/865511899735ab23d82b29d8592751c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -k "http://localhost:8108/collections" -X POST -H "Content-Type: application/json" \ | |
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{ | |
"name": "titles", | |
"fields": [ | |
{"name": "embedding", "type": "float[]", "num_dim": 3}, | |
{"name": "title", "type": "string"} | |
] | |
}' | |
curl "http://localhost:8108/collections/titles/documents" -X POST \ | |
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Title 1", "embedding": [0.1, 0.2, 0.3]}' | |
curl "http://localhost:8108/collections/titles/documents" -X POST \ | |
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" -d '{"title": "Title 2", "embedding": [0.4, 0.5, 0.6]}' | |
# Returns the vector field | |
curl 'http://localhost:8108/multi_search' -H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" --data-raw '{ | |
"per_page": 1, | |
"searches":[ | |
{ | |
"q":"*", | |
"include_fields": "embedding", | |
"collection": "titles" | |
} | |
] | |
}' | |
{"results":[{"facet_counts":[],"found":2,"hits":[{"document":{"embedding":[0.4,0.5,0.6]},"highlight":{},"highlights":[]},{"document":{"embedding":[0.1,0.2,0.3]},"highlight":{},"highlights":[]}],"out_of":2,"page":1,"request_params":{"collection_name":"titles","per_page":10,"q":"*"},"search_cutoff":false,"search_time_ms":0}]}% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment