Skip to content

zincsearch/sdk-python-zincsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zincsearch-sdk

Zinc Search engine API documents https://docs.zincsearch.com

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.3.3
  • Package version: 0.3.3
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.zincsearch.com

Requirements.

Python >=3.6

Installation & Usage

pip install

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

pip install git+https://github.com/zinclabs/sdk-python-zincsearch.git

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

Then import the package:

import zincsearch_sdk

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 zincsearch_sdk

Getting Started

Please follow the installation procedure and then run the following:

import time
import zincsearch_sdk
from pprint import pprint
from zincsearch_sdk.api import document
from zincsearch_sdk.model.meta_http_response_document import MetaHTTPResponseDocument
from zincsearch_sdk.model.meta_http_response_error import MetaHTTPResponseError
from zincsearch_sdk.model.meta_http_response_id import MetaHTTPResponseID
from zincsearch_sdk.model.meta_http_response_record_count import MetaHTTPResponseRecordCount
from zincsearch_sdk.model.meta_json_ingest import MetaJSONIngest
# Defining the host is optional and defaults to http://localhost:4080
# See configuration.py for a list of all supported configuration parameters.
configuration = zincsearch_sdk.Configuration(
    host = "http://localhost:4080"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure HTTP basic authorization: basicAuth
configuration = zincsearch_sdk.Configuration(
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)


# Enter a context with an instance of the API client
with zincsearch_sdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = document.Document(api_client)
    query = "query_example" # str | Query

    try:
        # Bulk documents
        api_response = api_instance.bulk(query)
        pprint(api_response)
    except zincsearch_sdk.ApiException as e:
        print("Exception when calling Document->bulk: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost:4080

Class Method HTTP request Description
Document bulk POST /api/_bulk Bulk documents
Document bulkv2 POST /api/_bulkv2 Bulkv2 documents
Document delete DELETE /api/{index}/_doc/{id} Delete document
Document es_bulk POST /es/_bulk ES bulk documents
Document index POST /api/{index}/_doc Create or update document
Document index_with_id PUT /api/{index}/_doc/{id} Create or update document with id
Document multi POST /api/{index}/_multi Multi documents
Document update POST /api/{index}/_update/{id} Update document with id
Index add_or_remove_es_alias POST /es/_aliases Add or remove index alias for compatible ES
Index analyze POST /api/_analyze Analyze
Index analyze_index POST /api/{index}/_analyze Analyze
Index create POST /api/index Create index
Index create_template POST /es/_index_template Create update index template
Index delete DELETE /api/index/{index} Delete index
Index delete_template DELETE /es/_index_template/{name} Delete template
Index e_s_create_index PUT /es/{index} Create index for compatible ES
Index e_s_get_mapping GET /es/{index}/_mapping Get index mappings for compatible ES
Index es_exists HEAD /es/{index} Checks if the index exists for compatible ES
Index exists HEAD /api/index/{index} Checks if the index exists
Index get_es_aliases GET /es/{target}/_alias/{target_alias} Get index alias for compatible ES
Index get_index GET /api/index/{index} Get index metadata
Index get_mapping GET /api/{index}/_mapping Get index mappings
Index get_settings GET /api/{index}/_settings Get index settings
Index get_template GET /es/_index_template/{name} Get index template
Index index_name_list GET /api/index_name List index Name
Index list GET /api/index List indexes
Index list_templates GET /es/_index_template List index teplates
Index refresh POST /api/index/{index}/refresh Resfresh index
Index set_mapping PUT /api/{index}/_mapping Set index mappings
Index set_settings PUT /api/{index}/_settings Set index Settings
Index update_template PUT /es/_index_template/{name} Create update index template
Search delete_by_query POST /es/{index}/_delete_by_query Searches the index and deletes all matched documents
Search msearch POST /es/_msearch Search V2 MultipleSearch for compatible ES
Search search POST /es/{index}/_search Search V2 DSL for compatible ES
Search search_v1 POST /api/{index}/_search Search V1
User create POST /api/user Create user
User delete DELETE /api/user/{id} Delete user
User list GET /api/user List user
User login POST /api/login Login
User update PUT /api/user Update user
Default healthz GET /healthz Get healthz
Default version GET /version Get version

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in zincsearch_sdk.apis and zincsearch_sdk.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from zincsearch_sdk.api.default_api import DefaultApi
  • from zincsearch_sdk.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import zincsearch_sdk
from zincsearch_sdk.apis import *
from zincsearch_sdk.models import *