Home
NOTE: I'm in the middle of upgrading the site. Most things are in place, but some things are missing and/or broken. This includes alt text for images. Please bear with me while I get things fixed.

Post To Meilisearch With The Python SDK

This is how I'm sending updates to Meilisearch via Python with authenciation via values stored in the default Keycain Access mac app and the python keyring library. (keyring works on other operating systems as well if you're not on a mac)

import json
  import keyring
  import meilisearch


  domain = "http://localhost:7700"
  admin_key = keyring.get_password(
      'alan--meilisearch--scratchpad--admin-key',
      'alan'
  )

  client = meilisearch.Client(
      domain,
      admin_key
  )

  documents = [
      { "id": "file-1", "content": "this is file one" },
      { "id": "file-2", "content": "second file here" },
      { "id": "file-3", "content": "take three" }
  ]

  response = client.index('test-6').add_documents(documents)

  print(json.dumps(response, sort_keys=True, indent=2, default=str))

#+RESULTS : : { : "enqueuedAt" : "2022 - 05 - 24T22 : 02 : 19.643685Z", : "indexUid" : "test - 6", : "status" : "enqueued", : "type" : "documentAddition", : "uid" : 10171 : }

~ fin ~