Questions tagged [elasticsearch-dsl-py]

Elasticsearch DSL is a high-level Python library whose aim is to help with writing and running queries against Elasticsearch.

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.

148 questions
0
votes
2 answers

Date histogram aggregation Elasticsearch

I want to filter and get data from elastic search. where I have tried Date histogram aggregation but its not solving my purposes. I have data like: [ { "id":1, "title":"Sample news", "date":"2020-09-17", "regulation":[ …
0
votes
0 answers

Analyse single tags per post in Elasticsearch dsl

I have a ES instance running with data from travel.stackexchange. # Example Data first = ["This was one of our definition questions, but also one that interests me personally: How can I find a guide that will take me safely through the…
0
votes
0 answers

How can I sort nested fields?

Below data is the output of the search query of the elastic search index. I want to sort data based on review.rate field. How can I do it? Data [{ "name": "ABC", "review": [{ 'rate': 1.5, 'note': "XYZ", 'type':…
0
votes
0 answers

Elasticsearch: Save aggregations query into CSV file

I have data such as: { "_index": "user_log", "_type": "logs", "_id": "gdUJpXIBAoADuwvHTK29", "_score": 1, "_source": { "user_id": 105, "user_name": "prathameshsalap@gmail.com", "working_hours": "2019-10-21 09:00:01", …
0
votes
1 answer

auto complete in elastic search using python

i have index company_prod2 which gives back hits in kibana with following query : POST company_prod2/_search?pretty { "suggest": { "field-suggest" : { "prefix" : "cooi", "completion" : { "field" :…
0
votes
1 answer

Elasticsearch Indexing in Django Celery Task

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…
littleK
  • 19,521
  • 30
  • 128
  • 188
0
votes
2 answers

Authntication finally failed error on AWS ElasticSearch Service

I'm trying to upgrade a Django application from using AWS ElasticSearch 2.3 to 7.4 (and upgrade the Django packages at the same time). I have it running locally, but when I attempt to run with AWS ElasticSearch7.4 I get the following…
HenryM
  • 5,557
  • 7
  • 49
  • 105
0
votes
1 answer

How to include shingle elasticsearch filter in analyzer with Python elasticsearch_dsl

I am using elastic search for full text search in a Django application. I am using the elastic_dsl library from pypi to interface with the cluster. I am trying to implement a shingle filter in the analyzer. I believe I have gotten it to work with…
Neil
  • 3,020
  • 4
  • 25
  • 48
0
votes
1 answer

Sorting on a field

I am doing a sort on an Elasticsearch field but it gives me an error. I do this: s = s.sort({'productForm': {"order": "desc"}}) I get the following error RequestError(400, u'search_phase_execution_exception', u'Fielddata is disabled on text fields…
mozman2
  • 911
  • 1
  • 8
  • 17
0
votes
1 answer

How to persist a document in json format using elasticsearch-dsl

I am trying to update an existing elasticsearch data pipeline and would like to use elasticsearch-dsl more fully. In the current process we create a document as a json object and then use requests to PUT the object to the relevant elasticsearch…
whatapalaver
  • 865
  • 13
  • 25
0
votes
1 answer

What is the correct way to use the elasticsearch-dsl Percolate query?

s = Search(index='test-index').using(client) q = Q('percolate', field="query", documents=list_of_documents) s = s.query(q) p = s.execute() I am attempting to run a percolation query against an index, with a list of documents…
0
votes
2 answers

How to transform a Kibana query to `elasticsearch_dsl` query

I have a query GET index/_search { "query": { "bool": { "should": [ { "match": { "key1": "value" } }, { "wildcard": { "key2": "*match*" } } …
Logic
  • 2,230
  • 2
  • 24
  • 41
0
votes
1 answer

How to efficently flatten JSON structure returned in elasticsearch_dsl queries?

I'm using elasticsearch_dsl to make make queries for and searches of an elasticsearch DB. One of the fields I'm querying is an address, which as a structure like so: address.first_line address.second_line address.city adress.code The returned…
0
votes
1 answer

Elasticsearch-dsl nested filtering

I'm using elasticsearch-dsl library and my Documents are like these: class Market(InnerDoc): market_no = Integer() class Event(Document): event_id = Integer() markets = Nested(Market) I want to get all Events and within these Events I…
0
votes
2 answers

Django ElasticSearch returns only 10 rowsets

I am using ElasticSearch-DSL in my django application and the query returns only 10 rows. When I use size. I get an error "multi_match" query does not support size. from django.shortcuts import render from elasticsearch_dsl import Q from…