Home

Awesome

Manticore Python client

Сlient for Manticore Search.

❗ WARNING: this is a development version of the client. The latest release's readme is https://github.com/manticoresoftware/manticoresearch-python/tree/4.0.0

Requirements.

Minimum Manticore Search version is >= 2.5.1 with HTTP protocol enabled.

Manticore Searchmanticoresearch-pythonPython
devmanticoresearch-devel>= 3.4
>= 6.2.0>= 3.3.1>= 3.4
>= 4.2.1>= 2.0.x>= 3.4
>= 4.0.2 < 4.2.1>= 1.0.6>= 3.4
>= 2.5.1 < 4.0.2>= 1.0.5>= 2.7

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/manticoresoftware/manticoresearch-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/manticoresoftware/manticoresearch-python.git)

Then import the package:

import manticoresearch

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import manticoresearch

Getting Started

Please follow the installation procedure and then run the following:

import manticoresearch
from manticoresearch.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://127.0.0.1:9308
# See configuration.py for a list of all supported configuration parameters.
configuration = manticoresearch.Configuration(
    host = "http://127.0.0.1:9308"
)



# Enter a context with an instance of the API client
with manticoresearch.ApiClient(configuration) as api_client:
    # Create instances of API classes
    indexApi = manticoresearch.IndexApi(api_client)
    searchApi = manticoresearch.SearchApi(api_client)

    try:
        # Perform insert and search operations    
        newDoc = {"title" : "Crossbody Bag with Tassel", "price": 19.85}
        insert_request = InsertDocumentRequest(index="products", doc=newDoc)
        indexApi.insert(insert_request)

        newDoc = {"title" : "Pet Hair Remover Glove", "price": 7.99}
        insert_request = InsertDocumentRequest(index="products", doc=newDoc)
        indexApi.insert(insert_request)
        
        query_highlight = Highlight()
        query_highlight.fields = {"title":{}}
        search_query = SearchQuery(query_string="@title bag")
        search_request = SearchRequest(index="products", query=search_query, highlight=query_highlight)
        search_response = searchApi.search(search_request)    
        print("The response of SearchApi->search:\n")
        pprint(search_response)

        # Alternatively, you can pass all request arguments as JSON strings        
        indexApi.insert({"index": "products", "doc" : {"title" : "Crossbody Bag with Tassel", "price" : 19.85}})
        indexApi.insert({"index": "products", "doc" : {"title" : "Pet Hair Remover Glove", "price" : 7.99}})
        search_response = searchApi.search({"index": "products", "query": {"query_string": "@title bag"}, "highlight":{"fields":{"title":{}}}})
        print("The response of SearchApi->search:\n")
        pprint(search_response)
    except ApiException as e:
        print("Exception when calling Api method: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://127.0.0.1:9308

ClassMethodHTTP requestDescription
IndexApibulkPOST /bulkBulk index operations
IndexApideletePOST /deleteDelete a document in an index
IndexApiinsertPOST /insertCreate a new document in an index
IndexApipartial_replacePOST /{index}/_update/{id}Partially replaces a document in an index
IndexApireplacePOST /replaceReplace new document in an index
IndexApiupdatePOST /updateUpdate a document in an index
SearchApipercolatePOST /pq/{index}/searchPerform reverse search on a percolate index
SearchApisearchPOST /searchPerforms a search on an index
UtilsApisqlPOST /sqlPerform SQL requests

Documentation For Models

<a id="documentation-for-authorization"></a>

Documentation For Authorization

Endpoints do not require authorization.

Author

info@manticoresearch.com