Gives API access to all Algolia functionality, settings, advanced features, and ML/AI products
Asynchronous methods built on top of Asyncio
Background retry strategy to ensure uptime
Seamless batching via iterators to optimize number of network calls
Zero downtime reindexing feature
Thin & minimal low-level HTTP client to interact with Algolia's API
Fully “pythonic”, follows modern Python while supporting Python 2
Supports Python: 2.7, 3.4, 3.5, 3.6, 3.7, 3.8
INDEX
const objects = [{
firstname: 'Jimmie',
lastname: 'Barninger',
objectID: 'myID1'
}, {
firstname: 'Warren',
lastname: 'Speach',
objectID: 'myID2'
}];
index.saveObjects(objects).then(({ objectIDs }) => {
console.log(objectIDs);
});
SEARCH
from algoliasearch.search_client import SearchClient
client = SearchClient.create("AppId", "AdminAPIKey")
index = client.init_index("index_name")
# index records
records = [
{"objectID": "myID1", "firstname": "Jimmie", "lastname": "Barninger"},
{"objectID": "myID2", "firstname": "Warren", "lastname": "Speach"},
]
index.save_objects(records).wait()
# only query string
res = index.search('Jim')
print(res)
# or with params
res = index.search('Jim', {
'attributesToRetrieve': [ 'firstname', 'lastname' ],
'hitsPerPage': 50
})
print(res)