elasticsearch-dsl-py | High level Python client for Elasticsearch | JSON Processing library

 by   elastic Python Version: v7.4.1 License: Apache-2.0

kandi X-RAY | elasticsearch-dsl-py Summary

kandi X-RAY | elasticsearch-dsl-py Summary

elasticsearch-dsl-py is a Python library typically used in Utilities, JSON Processing applications. elasticsearch-dsl-py has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has high support. You can install using 'pip install elasticsearch-dsl-py' or download it from GitHub, PyPI.

Elasticsearch DSL is a high-level library whose aim is to help with writing and running queries against Elasticsearch. It is built on top of the official low-level client (`elasticsearch-py `_). It provides a more convenient and idiomatic way to write and manipulate queries. It stays close to the Elasticsearch JSON DSL, mirroring its terminology and structure. It exposes the whole range of the DSL from Python either directly using defined classes or a queryset-like expressions. It also provides an optional wrapper for working with documents as Python objects: defining mappings, retrieving and saving documents, wrapping the document data in user-defined classes. To use the other Elasticsearch APIs (eg. cluster health) just use the underlying client.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              elasticsearch-dsl-py has a highly active ecosystem.
              It has 3665 star(s) with 792 fork(s). There are 417 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 125 open issues and 1144 have been closed. On average issues are closed in 63 days. There are 24 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of elasticsearch-dsl-py is v7.4.1

            kandi-Quality Quality

              elasticsearch-dsl-py has 0 bugs and 0 code smells.

            kandi-Security Security

              elasticsearch-dsl-py has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              elasticsearch-dsl-py code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              elasticsearch-dsl-py is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              elasticsearch-dsl-py releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              elasticsearch-dsl-py saves you 4296 person hours of effort in developing the same functionality from scratch.
              It has 9107 lines of code, 828 functions and 69 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed elasticsearch-dsl-py and discovered the below as its top functions. This is intended to give you an instant insight into elasticsearch-dsl-py implemented functionality, and help decide if they suit your requirements.
            • Save document to Elasticsearch
            • Get the name of the index
            • Set index
            • Return a dict representation of the document
            • Update the object from a dictionary
            • Create a Q expression
            • Create a aggregation function
            • Setup the index
            • Migrates a new index
            • Test the given dist
            • Run command
            • A dictionary of buckets
            • Return the number of records in the query
            • Get the metric values for the given data
            • Create a filter
            • Update the query from a dictionary
            • Run tests
            • Add a license header to a file
            • Find files that need fix
            • Shortcut for a type shortcut
            • Returns a list of search results
            • Highlight given fields
            • Migrate a new index
            • Instantiate a score function
            • Sort the query
            • Add an answer to the shard
            • Suggest a suggestion
            Get all kandi verified functions for this library.

            elasticsearch-dsl-py Key Features

            No Key Features are available at this moment for elasticsearch-dsl-py.

            elasticsearch-dsl-py Examples and Code Snippets

            No Code Snippets are available at this moment for elasticsearch-dsl-py.

            Community Discussions

            QUESTION

            elasticsearch on python gives name or service not known
            Asked 2022-Jan-29 at 11:01

            I'm working with an elastic API on a url like https://something.xyzw.eg/api/search/advance (not the real url). The API works fine on postman. Also the python code generated by postman works fine and returns results. However when using leasticsearch-dsl package I keep getting:

            Failed to establish a new connection: [Errno -2] Name or service not known)

            Here is my code similar to the first example on documents:

            ...

            ANSWER

            Answered 2022-Jan-29 at 09:46

            Can you try to add port=443 as in one of the examples from the doc you mentioned https://elasticsearch-py.readthedocs.io/en/v7.16.3/#tls-ssl-and-authentication ?

            Source https://stackoverflow.com/questions/70903867

            QUESTION

            Elasticsearch, how to store data per date?
            Asked 2021-Jan-29 at 01:27

            I'd like to store daily statistics of sales.

            By daily, I mean day of year.

            Conceptually the data would look like the following.

            ...

            ANSWER

            Answered 2021-Jan-28 at 13:22

            You can let ES generate the mappings for you with the help of dynamic template path matching:

            Source https://stackoverflow.com/questions/65936853

            QUESTION

            Pre-test tasks using pytest markers?
            Asked 2020-Dec-24 at 20:08

            I've got a Python application using pytest. For several of my tests, there are API calls to Elasticsearch (using elasticsearch-dsl-py) that slow down my tests that I'd like to:

            1. prevent unless a Pytest marker is used.
            2. If a marker is used, I would want that marker to execute some code before the test runs. Just like how a fixture would work if you used yield.

            This is mostly inspired by pytest-django where you have to use the django_db marker in order to make a conn to the database (but they throw an error if you try to connect to the DB, whereas I just don't want a call in the first place, that's all).

            For example:

            ...

            ANSWER

            Answered 2020-Dec-24 at 20:08

            Your initial approach with having a combination of a fixture and a custom marker is the correct one; in the code below, I took the code from your question and filled in the gaps.

            Suppose we have some dummy function to test that uses the official elasticsearch client:

            Source https://stackoverflow.com/questions/65434879

            QUESTION

            How do I create an “or” Condition filter using elasticsearch-dsl-py?
            Asked 2020-Aug-18 at 13:31

            The query below is what I would like to construct using elasticsearch-dsl-py, but I do not know how to do it.

            ...

            ANSWER

            Answered 2020-Aug-18 at 13:31

            I'm not sure which version of ES you're running, but just know that filtered has been replaced by bool a long time ago in version 5. So your query can be rewritten like this:

            Source https://stackoverflow.com/questions/63468866

            QUESTION

            How do I create an “In” Condition filter using elasticsearch-dsl-py?
            Asked 2020-Aug-14 at 10:46

            The query below is what I would like to construct using elasticsearch-dsl-py, but I do not know how to do it.

            ...

            ANSWER

            Answered 2020-Aug-14 at 10:46

            Another way of doing this is by using the terms query with an array as each array element is implicitly ORed. Also, I'm not sure which version of ES you're running, but just know that filtered has been replaced by bool a long time ago in version 5. So your query can be rewritten like this:

            Source https://stackoverflow.com/questions/63411075

            QUESTION

            Elasticsearch Indexing in Django Celery Task
            Asked 2020-Apr-24 at 15:56

            I’m building a Django web application to store documents and their associated metadata.

            The bulk of the metadata will be stored in the underlying MySQL database, with the OCR’d document text indexed in Elasticsearch to enable full-text search. I’ve incorporated django-elasticsearch-dsl to connect and synchronize my data models, as I’m also indexing (and thus, double-storing) a few other fields found in my models. I had considered using Haystack, but it lacks support for the latest Elasticsearch versions.

            When a document is uploaded via the applications’s admin interface, a post_save signal automatically triggers a Celery asynchronous background task to perform the OCR and will ultimately index the extracted text into Elasticsearch.

            Seeing as how I don’t have a full-text field defined in my model (and hope to avoid doing so as I don’t want to store or search against CLOB’s in the database), I’m seeking the best practice for updating my Elasticsearch documents from my tasks.py file. There doesn’t seem to be a way to do so using django-elasticseach-dsl (but maybe I’m wrong?) and so I’m wondering if I should either:

            1. Try to interface with Elasticsearch via REST using the sister django-elasticsearch-dsl-drf package.

            2. More loosely integrate my application with Elasticsearch by using the more vanilla elasticsearch-dsl-py package (based on elasticsearch-py). I‘d lose some “luxury” with this approach as I’d have to write a bit more integration code, at least if I want to wire up my models with signals.

            Is there a best practice? Or another approach I haven’t considered?

            Update 1: In trying to implement the answer from @Nielk, I'm able to persist the OCR'd text (result = "test" in tasks.py below) into ElasticSearch, but it's also persisting in the MySQL database. I'm still confused about how to essentially configure Submission.rawtext as a passthru to ElasticSearch.

            models.py:

            ...

            ANSWER

            Answered 2020-Apr-21 at 06:06

            You can add extra fields in the document definition linked to your model (see the field 'type_to_field' in the documentation https://django-elasticsearch-dsl.readthedocs.io/en/latest/fields.html#using-different-attributes-for-model-fields , and combine this with a 'prepare_xxx' method to initialize to an empty string if the instance is created, and to its current value in case of an update) Would that solve your problem ?

            Edit 1 - Here's what I meant:

            models.py

            Source https://stackoverflow.com/questions/61282288

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install elasticsearch-dsl-py

            You can install using 'pip install elasticsearch-dsl-py' or download it from GitHub, PyPI.
            You can use elasticsearch-dsl-py like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            Documentation is available at https://elasticsearch-dsl.readthedocs.io.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/elastic/elasticsearch-dsl-py.git

          • CLI

            gh repo clone elastic/elasticsearch-dsl-py

          • sshUrl

            git@github.com:elastic/elasticsearch-dsl-py.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular JSON Processing Libraries

            json

            by nlohmann

            fastjson

            by alibaba

            jq

            by stedolan

            gson

            by google

            normalizr

            by paularmstrong

            Try Top Libraries by elastic

            elasticsearch

            by elasticJava

            kibana

            by elasticTypeScript

            logstash

            by elasticJava

            beats

            by elasticGo

            eui

            by elasticTypeScript