Skip to main content

Serverless full text search in Python

Project description

Locasticsearch

Serverless full text search in Python

Locasticsearch provides serverless full text search powered by sqlite full text search capabilities but trying to be compatible with a subset of the elasticsearch API.

That way you can comfortably develop your text search appplication without needing to set up servers, but knowing that you are not locked in to a library. When you are ready to .

That said, if you are only doing basic search operations within the subset supported by this library, and you dont have a lot of documents (less than a million) that would justify going for a cluster deployment, Locasticsearch can be a faster alternative to Elasticsearch.

Test Publish Coverage Package version Python Versions

Getting started

from locasticsearch import Locasticsearch
from datetime import datetime

es = Locasticsearch()

doc = {
    "author": "kimchy",
    "text": "Elasticsearch: cool. bonsai cool.",
    "timestamp": datetime(2010, 10, 10, 10, 10, 10),
}
res = es.index(index="test-index", doc_type="tweet", id=1, body=doc)

res = es.get(index="test-index", doc_type="tweet", id=1)
print(res["_source"])

es.indices.refresh(index="test-index")

res = es.search(index="test-index", body={"query": {"match_all": {}}})
print("Got %d Hits:" % res["hits"]["total"]["value"])
for hit in res["hits"]["hits"]:
    print("%(timestamp)s %(author)s: %(text)s" % hit["_source"])

Features

  • 💯% local, no server management
  • ✨ Lightweight pure python, no external dependencies
  • ⚡ Super fast searches thanks to sqlite full text search capabilities
  • 🔗 No lock in. Thanks to the API compatiblity with the official client, you can smoothly transition to Elasticsearch for scale or more features without changing your code.

Install

pip install locasticsearch

To use or not to use

You should NOT use Locasticsearch if:

  • you are deploying a security sensitive application. Locasticsearch code is very prone to SQL injection attacks.
  • Your searches are more complicated than what you would find in a 5 min Elasticsearch tutorial. Elasticsearch has a huge API and it is very unlikely that we can support even a sizable portion of that.
  • You hate buggy libraries. Locasticsearch is a very young project so bugs are guaranteed. Check the tests to see if your needs are covered.

You should use Locasticsearch if:

  • you dont want a docker or an elasticsearch service using precious resources in your laptop
  • you have basic text search needs and Elasticsearch would be overkill
  • you want very easy deployments that only involve pip installs
  • using Java from a python program makes you feel dirty

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locasticsearch-0.0.1.tar.gz (6.5 kB view hashes)

Uploaded Source

Built Distribution

locasticsearch-0.0.1-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page