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 aggregate by geo using elasticsearch_dsl?

If I have customer locations stored as geo_point datatype (latitude/longitude) and i need to determine doc_count grouped by the geo_point location, what is the elasticsearch_dsl syntax?
0
votes
0 answers

How to query nested path with spaces and other characters

I have a rather 'complex' elasticsearch document that has spaces present in the path. Is there any way in which to get the query working without a reindex? :) "_source": { "threads": { "MANAGEMENT DISCUSSION SECTION": [], "Q&A":…
Eamonn
  • 597
  • 7
  • 23
0
votes
1 answer

elasticsearch_dsl response multiple bucket aggregations

found this thread on how to frame nested aggregations using elasticsearch_dsl Generate multiple buckets in aggregation can someone show how to iterate through the response to get the second bucket results? for i in…
0
votes
2 answers

elasticsearch-DSL lib set default value for Text field on saving Document

how do we check if a Field object from elasticsearch-DSL lib (e.g. Text, Integer, Keyword) contains no value, say None or empty string? On such case, I need to set the field in Document object with some sort of default but dynamic value, before…
shiouming
  • 1,889
  • 4
  • 17
  • 26
0
votes
1 answer

How to lock a document while updating Elasticsearch?

I am using elasticsearch-dsl python library with my python code. I was trying to update the document, so to avoid the concurrency race conditions i need to acquire and free lock on a document. How to do this using this library. I have already gone…
Nipun Garg
  • 125
  • 6
0
votes
1 answer

Python ElasticSearch query showing false positives for multi match

Trying to create a searchable dashboard for end users with full text search capability on a csv dataset containing research topics using ElasticSearch with python. Search will return row index of the relevant csv rows. There are multiple columns…
0
votes
1 answer

Elastic search query containing '!' in regexp query doesnt match against any results

Elastic search below query doesn't return any results: 1.) {"query":{"regexp":{"field_name":".*f04((?!z).)*"}} Why a query like above doesn't return any result? I'm expecting results like this : ['f00bar', 'f04bar', 'f04barbuh', 'f04ba'] whereas…
0
votes
2 answers

Generate elastic search AND query based upon list size i.e no. of AND's in the query will be based on no. of items in the list

I have a list whose size is not fixed and can contain any no. of items. Based on the number of items in the list, I have to generate an elastic search AND query to find the exact match of values. For eg: If my list contains 2 items : ['a', 'b'], my…
0
votes
1 answer

How to retrieve last log when grouped by a specific attribute in elasticsearch_dsl?

Need to get the last log (based on timestamp) for each server using python elasticsearch_dsl for example here are the logs: Server Hour CPU% server1 8AM 19 server1 9AM 19 server1 10AM 29 server2 8AM 19 server2 9AM …
0
votes
2 answers

Elastic Search Suggestions Return Zero Results

Im trying to setup ElasticSearch using the elasticsearch_dsl python library. I have been able to setup the Index, and I am able to search using the .filter() method, but I cannot get the .suggest method to work. I am trying to use the completion…
gtalarico
  • 4,409
  • 1
  • 20
  • 42
0
votes
1 answer

Elastic search query find exact match of values in the list from regexp input parameter

My data looks like below: { "name": "name1", "name_gr": ["gr1","gr2"] }, { "name": "name2", "name_gr": ["gr1","gr2"] }, { "name": "name3", "name_gr": ["gr2","gr3"] }, { "name": "name4", "name_gr":…
0
votes
1 answer

finding multiple exact values using elastic search query

I have inserted some data like below in elastic search. The data (name_list) looks like below. { "manage": { "name_list": [ { "name": "name1", "name_gr": ["gr1","gr2"] }, { "name": "name2", …
0
votes
1 answer

connect localhost elastic search cluster on mirage

I'm trying to use Mirage to build my elastic search queries. I have started elastic search on localhost and when i do curl localhost:9210 on terminal, i get below details : "name" : "RN48HFb", "cluster_name" : "elasticsearch", "cluster_uuid" :…
0
votes
1 answer

multiple underscores in elasticsearch field name with python elasticsearch-dsl

I'm attempting to understand why a field with a single underscore, mods_genre would behave differently from a field with 1+ underscores, e.g. mods__genre when using the python elasticsearch-dsl client. Using ElasticSearch version 5.5.1, and python…
ghukill
  • 1,136
  • 17
  • 42
0
votes
0 answers

Search for more than one string in a field using elasticsearch_dsl

I am looking for ways to use elasticsearch_dsl to query for multiple strings on a single field. When I try using wildcard option, it just lists last string found For example, I need to look for following strings in field called…
Anil_M
  • 10,893
  • 6
  • 47
  • 74
1 2 3
9
10