Search API Client for Python

Python + Algolia

Build search experiences with libraries & UI components.

Sign up
What is Algolia

What is Algolia

Algolia empowers modern developers to build world class search and discovery experiences without any DevOps.
Libraries with every major language and framework make it easy to enrich your users' experiences. 

Python

API-first search and discovery for your Python applications

Utilize the Algolia open-source Python API client to index your data, configure your search, add analytics and much more.  

Algolia is an API-First Search and Discovery platform that empowers builders to compose experiences at scale. Explore Algolia

Features

  • 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

Version

  • Supports Python: 2.7, 3.4, 3.5, 3.6, 3.7, 3.8

Related Integrations

Get started

  • Install (get a free account here.)
    1
    npm install algoliasearch
  • Index
    1
    const objects = [{
    2
      firstname: 'Jimmie',
    3
      lastname: 'Barninger',
    4
      objectID: 'myID1'
    5
    }, {
    6
      firstname: 'Warren',
    7
      lastname: 'Speach',
    8
      objectID: 'myID2'
    9
    }];
    10
    11
    index.saveObjects(objects).then(({ objectIDs }) => {
    12
      console.log(objectIDs);
    13
    });
  • Search
    1
    from algoliasearch.search_client import SearchClient
    2
    3
    client = SearchClient.create("AppId", "AdminAPIKey")
    4
    index = client.init_index("index_name")
    5
    6
    # index records
    7
    records = [
    8
        {"objectID": "myID1", "firstname": "Jimmie", "lastname": "Barninger"},
    9
        {"objectID": "myID2", "firstname": "Warren", "lastname": "Speach"},
    10
    ]
    11
    index.save_objects(records).wait()
    12
    13
    # only query string
    14
    res = index.search('Jim')
    15
    print(res)
    16
    17
    # or with params
    18
    res = index.search('Jim', {
    19
        'attributesToRetrieve': [ 'firstname', 'lastname' ],
    20
        'hitsPerPage': 50
    21
    })
    22
    print(res)
Get started for free
Explore developer docs