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
1 answer

how to create an elastic search index which emulates my mysql db

I am new to elasticsearch and i am having tough time switching from mysql to elasticsearch my Mysql my tables looks like this table : test_request +---------+-------------+--------------+-----------+------------+-----------+ |…
0
votes
1 answer

Scan result of a aggregation

I wanted to see how many unique link that a user has posted for every user. Here is what I have come up so far s.aggs.bucket('user_term', A('terms', field='user__id')).metric('url_count', A('value_count', field='link')) However, I have yet found a…
Minh Triet
  • 1,190
  • 1
  • 15
  • 35
0
votes
2 answers

Any suggestions to customize an analyzer when using query match with elasticsearch-py?

I can't apply a custom analyzer when using query match with elasticsearch-py. I customized an analyzer called custom_lowercase_stemmed and used es.indices.put_settings to update the index setting. However, it couldn't find the analyzer when I do a…
0
votes
1 answer

Individually update a large amount of documents with the Python DSL Elasticsearch UpdateByQuery

I'm trying to use the UpdateByQuery to update a property of a large amount of documents. But as each document will have a different value, I need to execute ir one by one. I'm traversing a big amount of documents, and for each document I call this…
gal007
  • 6,911
  • 8
  • 47
  • 70
0
votes
1 answer

Python elasticsearch-dsl making query dynamically

I'm new to elastic search, I'm implementing it in python using the elasticsearch-dsl library. I'm stuck at creating queries dynamically. for example, I can simply do something like this directly, q = (Q('match', age=21) | Q('match', gender='male'))…
Jay Patel
  • 2,341
  • 2
  • 22
  • 43
0
votes
2 answers

Matching query with multiple values in Elasticsearch-dsl

I am trying to write a query, In which multiple values should get matched with the field. In the example, I am trying to get results from all months with the matching field in the query. What I don't know is, how to write this query in dsl ? months…
0
votes
1 answer

elasticsearch dsl python : how to search by value inside array

I have the following structure in my index: [ { name:"project1", users: [ {"id":"1"}, {"id":"2"} ] }, #... more projects ] I would like to know how can I get all projects…
hereForLearing
  • 1,209
  • 1
  • 15
  • 33
0
votes
1 answer

Composite Elasticsearch Aggregations using Elasticsearch DSL Python

I have the following query which is working fine here: { "aggs":{ "category_terms":{ "terms":{ "field":"Category" }, "aggs":{ "style_per_category":{ "terms":{ …
RoyaumeIX
  • 1,947
  • 4
  • 13
  • 37
0
votes
1 answer

How to write Elasticsearch query into elasticsearch-dsl in python

I'm trying to write a query to Elasticsearch using the elasticsearch-dsl library in Python 3.7. I think I managed to write most of it but I'm having an issue with an "exist" clause. This is the query I want to translate: { …
0
votes
2 answers

Programatically setting the read_only_allow_delete property of an index

I’m trying to execute the following line, but it throws an error (that I’m supposed to avoid by running the same code): es.indices.put_settings(index="demo_index", body={ "blocks": { "read_only_allow_delete": "false" …
gal007
  • 6,911
  • 8
  • 47
  • 70
0
votes
1 answer

Filter document to match either of the two fields in nested elasticsearch field

I have a field named tags in my document in elasticsearch with the following structure. tags = [ { "id": 10, "related": [9, 8, 7] } ] I now run a filter with a list. e.g. [10, 9]. I want to filter only those documents which…
Sudip Kafle
  • 4,286
  • 5
  • 36
  • 49
0
votes
1 answer

Elastic Search - example.com vs example

We are using elastic search 5.6.9 to power the search on our Django 1.11 server. If I am indexing data example.com and searching for example.com I get the search result, but if I am searching for example I don't get any search results. Ideally, I…
Ishan
  • 3,303
  • 5
  • 29
  • 47
0
votes
0 answers

Get relevant search results based on priority using Elasticsearch

I'm fairly new to elasticsearch and would like to have Natural Language Search on my JSON format database giving priority to specific keys and getting relevant results based on the priority. I have tried to search using Kibana but the search bar…
user10005853
0
votes
1 answer

Django Elasticsearch DSL TransportError for Mapper of Different Types

I'm working on a project using Python(3.6), Django(2.1), ElasticSearch(5.1.1) and Elasticsearch-dsl(5.4.0) in which I need to implement search functionality. Here's what I have tried: From models.py: class searchdatamodel(models.Model): id =…
0
votes
1 answer

Pythons Elasticsearch-DSL filter for exactly one match from list of values

I saw some realted posts but none of them match my exact issue. Using Python 2.7 with Elasticsearch-dsl (6.3, that is also my Elasticsearch version). I want to do something like, s = Search(using=elastic_conn, index='my_index').filter("match",…
Noam
  • 1,640
  • 4
  • 26
  • 55