Questions tagged [elasticsearch-py]

Python's official low-level client for Elasticsearch

174 questions
3
votes
1 answer

Python Elasticsearch create index mapping

I am trying to create a ES index with custom mapping with elasticsearch python to increase the size of text in each document: mapping = {"mapping":{ "properties":{ "Apple":{"type":"text","ignore_above":1000}, …
data_person
  • 3,024
  • 7
  • 28
  • 52
3
votes
1 answer

How to index columns created by django-modeltranslation to Elastic, using django-elasticsearch-dsl?

I've translated my Model fields with django-modeltranslation and implemented search using django-elasticsearch-dsl. Problem: django-modeltranslation creates translation fields in DB, and not in my Models, and search is working only for fields…
3
votes
1 answer

Searching through multiple index yielding 0 documents in elasticsearch-py

I have a search query to make across multiple indexes. To enable this as per the documentation, I need to provide a comma-separated list of indexes. But when I try to do it as: es.search(index='index1,index2',body=body) I get no result: {u'hits':…
Amogh Mishra
  • 795
  • 1
  • 8
  • 20
3
votes
1 answer

How to append to an array in Elasticsearch using elasticsearch-py

Using the Official ElasticSearch Python library (Docs) I create an index: doc = { "something": "123a", "somethingelse": "456b", "timestamp": datetime.now(), "history": [] } es.index(index="someindex", doc_type="somedoctype",…
AO_
  • 1,964
  • 1
  • 23
  • 30
3
votes
2 answers

Connecting to AWS Elasticsearch within VPC from Lambda over HTTPS

I have a Lambda written in Python which writes some data to Elasticsearch hosted on AWS. The ES service is within a VPC, so I'm trying to use the internal DNS of the ES to connect to it. This is my code: es_client = Elasticsearch( …
drunkenfist
  • 2,480
  • 10
  • 32
  • 65
3
votes
1 answer

Elasticsearch how to query on ID field higher than x

I am trying to apply pagination to results by querying multiple times to get past the 10k barrier of Elasticsearch. Since the results of Elasticsearch can differ during multiple queries I want to use the generated ID to get the next results. So for…
3
votes
1 answer

AuthorizationException: on Scan

I am trying to run what seems like a very simple Scan but I'm running into an odd exception. It seems like the generator created by the scan hits an exception and I have no idea why. I tried wrapping the interior of my for loop in a try/except but…
Obj3ctiv3_C_88
  • 1,318
  • 1
  • 13
  • 25
3
votes
0 answers

Python elasticsearch client returns true when type does not exists

I am trying to delete the mapping of a type but before doing that I am checking if the type exists as in the code below: def delete_mapping(self, doc_type): if self.elasticsearch.indices.exists_type(index='my_index', doc_type=doc_type): …
Cris Pinto
  • 242
  • 1
  • 14
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

Using multi_match with Elasticsearch bulk scan in Python

I'm trying to use the multi_match functionality within Elasticsearch using the elasticsearch-py library. Setting it up like this: res = helpers.scan(es, index="allcomms", query = { "multi_match" : { "query": 'multiple terms', …
Steven
  • 704
  • 1
  • 6
  • 19
2
votes
1 answer

python-elasticsearch: how do you enable curl logging?

I am using python-elasticsearch module, I read in the python-elasticsearch documentation that you can log all the underlying HTTP requests as command line curl commands: elasticsearch.trace can be used to log requests to the server in the form of…
Trevor Boyd Smith
  • 15,512
  • 24
  • 110
  • 159
2
votes
1 answer

Add a field in ElasticSearch using python with boolean datatype?

How do add a new field of a particular datatype(boolean) in Elasticsearch using python. Is this query correct? es.update(index='my_index', doc_type='my_doctype', id='id_of_doc', body={"doc": {"new_field":"boolean_value"},"type":"boolean"})
2
votes
4 answers

ElasticSearch Scroll API with multi threading

First of all, I want to let you guys know that I know the basic work logic of how ElasticSearch Scroll API works. To use Scroll API, first, we need to call search method with some scroll value like 1m, then it will return a _scroll_id that will be…
Always Sunny
  • 29,081
  • 6
  • 43
  • 74
2
votes
1 answer

Using HstoreField in Django/ElasticSearch

I'm new to elastic search and I really want to implement it in my Django project. My problem: I want to store a Python dict object ({'key_1': 'value_1', 'key_2': 'value_2', [...]}) and be sure that my search will look each key. In Django I…
2
votes
1 answer

escape special character in elasticsearch query

My question is simple, I can't use @ in the search query. Finally, I found that I can escape the special characters using the backslash. GET index/_search { "size": 20, "query": { "query_string": { "query": "\@as", "analyzer":…
Tamizharasan
  • 263
  • 1
  • 5
  • 16
1
2
3
11 12