Questions tagged [elasticsearch-py]

Python's official low-level client for Elasticsearch

194 questions
0
votes
2 answers

Best practise to remove stale documents in elasticsearch

I have a django app that pushes models into elasticsearch. I have a post signal to update after save but want to write a batch command that is updating all documents. Within this process I want to remove documents that became stale (e.g. set…
shredding
  • 5,374
  • 3
  • 46
  • 77
0
votes
1 answer

Python elasticsearch helpers.bulk erroneously fails? (script or doc is missing)

With the following payload in a python function [{'_id': '979507', [15/1871] '_index':…
limasxgoesto0
  • 4,555
  • 8
  • 31
  • 38
0
votes
1 answer

Temporarily disable facets in Python's FacetedSearch

I have created my own customised FacetedSearch class using Pythons Elasticsearch DSL library to perform search with additional filtering in def search(self). Now I would like to reuse my class to do some statistical aggregations. To stay DRY I want…
igo
  • 6,359
  • 6
  • 42
  • 51
0
votes
2 answers

elasticsearch-dsl - Aggregates collecting average in python

I'm trying to use the elasticsearch-dsl library, but unfortunately it's not well documented. I have the following filter, which works. First I find how far back I need my search. longtime = datetime.datetime.strptime(str(datetime.datetime.now() -…
0
votes
1 answer

Empty response while querying Elasticsearch multiple times

I write a script to get some data using nested queries and elaticsearch-dsl-py. Everything worked well until I added while ids_left > 0 loop to get data from Elasticsearch by chunks. Now I get data in response only for the first chunk. And I have…
srgbnd
  • 5,404
  • 9
  • 44
  • 80
0
votes
1 answer

Add new field to a nested object

Elasticsearch 2.3.3 I can't add a new field into an existing document via update API. How can I add it? Below you can see Elasticsearch Python API script for the document update. The update query is assigned to the query variable. import pdb,…
srgbnd
  • 5,404
  • 9
  • 44
  • 80
0
votes
1 answer

How to configure elasticsearch to use SSL with basic auth

I am trying to deploy an app that uses Ramses (http://ramses.tech) on IBM Bluemix. Unfortunately, the app is crashing during the deploy process. In the local.ini configuration file I have set the following: # ElasticSearch elasticsearch.hosts =…
0
votes
2 answers

Elasticsearch "get by index" returns the document, while "match_all" returns no results

I am trying to mock elasticsearch data for hosted CI unit-testing purposes. I have prepared some fixtures that I can successfully load with bulk(), but then, for unknown reason, I cannot match anything, even though the test_index seemingly contains…
zahory
  • 911
  • 2
  • 7
  • 10
0
votes
2 answers

Elasticsearch delete_by_query wrong usage

I am using 2 similar ES methods to load and delete documents: result = es.search(index='users_favourite_documents', doc_type='favourite_document', body={"query": {"match": {'user': user}}}) And: result =…
Albert
  • 113
  • 2
  • 13
0
votes
1 answer

How to logging unicode dictionary from elasticsearch-py?

By default, elasticsearch-py logs output dictionary as json dumped like: {'key': '2016\u5e747\u670829\u65e5'} While I'd like to see the result as following: {'key': '2016年7月29日'} How can I do that? EDIT Python 2.7.10 $ pip freeze | grep…
0
votes
1 answer

How to query on unanalyzed fields?

I have a few things in my elasticsearch_dsl class that i want to query for an exact match: class Profile(DocType): name = String(fields={'raw': String(index='not_analyzed')}) While that does work, i always need to add a .raw to the query and…
shredding
  • 5,374
  • 3
  • 46
  • 77
0
votes
1 answer

Error while deleting a index in Elastic search

I am working with Elastic search Python API. I created a index called "sample". But, facing an exception while trying to delete the same. Below is my approach. Elastic search instance, es = Elasticsearch("abc.def.ghi.jkl:9300") Checking whether…
Jack Daniel
  • 2,527
  • 3
  • 31
  • 52
0
votes
1 answer

Python elasticsearch return only entries that have a certain field

I'm trying to query an Elasticsearch, and only get results that have a certain field. How do I query for documents that have field fields.EventData.PGID and ignore ones that don't? datadict = es.search(index=idx1, …
Hal T
  • 527
  • 7
  • 22
0
votes
0 answers

Advanced Query in Elasticsearch

I have started using elasticseach engine with my application, and I have encountered a problem. I'm currently indexing as the following: each entry has its - username file_path md5 My goal is to determine how many unique (count of 1 per username )…
Den1al
  • 617
  • 1
  • 10
  • 16
0
votes
0 answers

Range query not formatted properly? (Elasticsearch)

I am using the python elastic search client to query my elasticsearch index. My index is very small, because I am trying to deduce where my query is going wrong. Here is an example entry _source: { Expiration: 20160115 } and another _source: { …
Zack
  • 13,454
  • 24
  • 75
  • 113
1 2 3
12
13