How to use elasticsearch6 - 2 common examples

To help you get started, we’ve selected a few elasticsearch6 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github federicotdn / inelastic / inelastic.py View on Github external
global vprint
        vprint = lambda *args, **kwargs: None  # noqa: E731

    es_version = get_elasticsearch_version(args.host, args.port)

    if es_version == "7":
        es_class = Elasticsearch7
        if args.doctype:
            print(
                "Can't specify document type (-d/--doctype) when using "
                "Elasticsearch 7.X or greater.",
                file=sys.stderr,
            )
            exit(1)
    elif es_version == "6":
        es_class = Elasticsearch6
        if not args.doctype:
            args.doctype = DOC_TYPE
    else:
        print(
            "Elasticsearch version {} not supported.".format(es_version),
            file=sys.stderr,
        )
        exit(1)

    vprint("Elasticsearch major version:", es_version)

    es = es_class(args.host, port=args.port)

    vprint("Starting inelastic script...")

    inv_index = get_inverted_index(
github HumanExposure / factotum / dashboard / views / search_chemicals.py View on Github external
def search_chemicals(request, template_name="search/es_chemicals.html"):
    """
    Returns both the raw elasticsearch results and the django objects 
    """

    q = request.GET.get("q", "")
    es = Elasticsearch(
        [
            {
                "host": settings.ELASTIC_HOST,
                "port": settings.ELASTIC_PORT,
                "use_ssl": False,
            }
        ]
    )
    es_return = es.search(
        index="factotum_chemicals",
        body={
            "aggs": {
                "data_documents": {
                    "terms": {
                        "field": "data_document_id",
                        "order": {"score_sum": "desc"},

elasticsearch6

Python client for Elasticsearch

Apache-2.0
Latest version published 4 years ago

Package Health Score

63 / 100
Full package analysis

Popular elasticsearch6 functions

Similar packages