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
3
votes
0 answers

Python Elasticsearch error sorting keyword field

Within a Python project I have an elastic search index that throws the following error when I sort on a given field: elasticsearch.exceptions.RequestError: RequestError(400, 'search_phase_execution_exception', 'Fielddata is disabled on text fields…
rurp
  • 1,376
  • 2
  • 14
  • 22
3
votes
1 answer

negative lookahead Regexp doesnt work in ES dsl query

The mapping of my Elastic search looks like below: { "settings": { "index": { "number_of_shards": "5", "number_of_replicas": "1" } }, "mappings": { "node": { "properties": { "field1": { "type":…
3
votes
0 answers

form elastic search queries after parsing expressions through ply(python library)

I have written a parser using python PLY library. Elastic search mapping schema looks like below: { "settings": { "index": { "number_of_shards": "5", "number_of_replicas": "1" } }, "mappings": { "type1": { …
3
votes
2 answers

elasticsearch_dsl: Generate multiple buckets in aggregation

I want to generate this: GET /packets-2017-09-25/_search { "size": 0, "query": { "match": { "transport_protocol": "tcp" } }, "aggs": { "clients": { "terms": { "field": "layers.ip.src.keyword", …
Bhakta Raghavan
  • 664
  • 6
  • 16
2
votes
1 answer

Elasticsearch DSL, filter list of objects with in list of values

my data looks like this: [ { "id": "00f0bbe514dcaf262c8a", "status": "CL", "type": "opportunity", "locations": [ { "name": "New York, USA", "lat": 99.0853, …
2
votes
1 answer

How to map keyword field in Django Elasticsearch?

I am using django-elasticsearch-dsl library a high level client to interact with elasticsearch. This is my Document.py file from django_elasticsearch_dsl import Document from django_elasticsearch_dsl.registries import registry from .models import…
Sachin
  • 103
  • 7
2
votes
1 answer

Search on NestedField with django-elasticsearch-dsl

I don't understand how to search with a NestedField. I first want to filter the results using a PK and then make a search on several fields from one or more words. I created a nestedfield because the relationship is "manytomany". My Model: class…
darkvodka
  • 303
  • 1
  • 3
  • 11
2
votes
1 answer

django-elasticsearch-dsl NestedFiled not working for ManyToManyField

I have successfully been able to declare, map, and populate all model fields to Elasticsearch Index except the Price field on the BookPrice model which is using through attribute. If I remove the Price field from the document then it works…
Devendra
  • 73
  • 7
2
votes
2 answers

failed to parse field [review_start_datetime] of type [date] in document with id 'DEMO_54ddab6'

Index Mapping "review_start_datetime" : { "type" : "date" }, "review_start_time" : { "type" : "date" } Class from elasticsearch_dsl import Document, Date class DocumentX(Document): review_start_datetime = Date(format='yyyy-MM-dd…
2
votes
1 answer

A list of locations that contain a GeoPoint - (geo_spatial_filter_fields, geo_distance)

I'm using elasticsearch-dsl-drf, and I just converted a single location field on my document, to a NestedField with this definition: location = fields.NestedField(properties={"point": fields.GeoPointField()}) Then on my view I have (I added path and…
2
votes
1 answer

Is it possible, in Elasticsearch, to do a temporary POST to an index?

I would like to know if I can temporarily save a document to an index, and when I want to actually fully publish/POST this document, can I take the "temporary"/"dry-run" flag away from the document?
2
votes
1 answer

Django Elastic Search DSL with faceted Search

I am using ElasticSearch-DSL with my Django App to search for products. I am able to fetch the results and put them in my template (search.html) and it is working as expected. I did some research but could not figure out how to add faceted search to…
Rohit Prasad
  • 135
  • 2
  • 12
2
votes
1 answer

How to compound terms query and bool query together in Elasticsearch

Originally, I would add a filter in the bool query. However, when I turn to terms filter, the documents indicates that it should be replaced by terms query now. So I understand this as that we need to construct a compound query with both terms query…
Bs He
  • 717
  • 1
  • 10
  • 22
2
votes
2 answers

Units of an elasticsearch query to get distance from arbitrary point to Geopoint

I have a django project which uses elasticsearch 6.5.3 to index products in a store with locations as GeoPoints. I am trying to query this index and also calculate distance between an arbitrary point, say user's location to each oh these results. I…
philoj
  • 468
  • 2
  • 13
2
votes
1 answer

make use of Elastic search dsl python analyze api

How to make use of default _analyze in elastic search dsl python? My query looks like below: query = Q('regexp', field_name = "f04((?!z).)*") search_obj = Search(using = conn, index = index_name, doc_type = type_name).query(query) response =…
1
2
3
9 10