Python's official low-level client for Elasticsearch
Questions tagged [elasticsearch-py]
174 questions
48
votes
1 answer
How to update a document using elasticsearch-py?
Does anyone have an example for how to use update? It's documented here, but the documentation is unclear and doesn't include a working example. I've tried the following:
coll =…
Dan Hook
- 5,725
- 7
- 31
- 48
39
votes
4 answers
python elasticsearch client set mappings during create index
I can set mappings of index being created in curl command like this:
{
"mappings":{
"logs_june":{
"_timestamp":{
"enabled":"true"
},
"properties":{
"logdate":{
"type":"date",
…
user4005632
19
votes
1 answer
Elasticsearch is not sorting the results
I'm having problem with an elasticsearch query.
I want to be able to sort the results but elasticsearch is ignoring the sort tag. Here my query:
{
"sort": [{
"title": {"order": "desc"}
}],
"query":{
"term": { "title":…
Alberto Menendez Romero
- 515
- 1
- 7
- 18
15
votes
2 answers
What is the Elasticsearch-py equivalent to alias actions?
I am trying to implement multiples indices approach using elasticsearch-dsl. There are basically two steps:
1. Create aliases:
PUT /tweets_1/_alias/tweets_search
PUT /tweets_1/_alias/tweets_index
2. Change alias when necessary:
POST /_aliases
{
…
Montenegrodr
- 1,443
- 10
- 26
15
votes
1 answer
Bulk update with Python's elasticsearch client
I'm attempting to do a bulk update based on state change on a document property. Create works fine but bulk is freaking out. I'm getting an error to the effect of "script or doc is missing" but everything looks good.
Here is how I am attempting the…
Obj3ctiv3_C_88
- 1,318
- 1
- 13
- 25
6
votes
3 answers
How do I create a (dockerized) Elasticsearch index using a python script running in a docker container?
I'm trying to index a containerized Elasticsearch db using the Python client https://github.com/elastic/elasticsearch-py called from a script (running in a container too).
By looking at existing pieces of code, it seems that docker-compose is a…
Davide Fiocco
- 3,631
- 1
- 23
- 53
6
votes
2 answers
Add Timestamp to ElasticSearch with Elasticsearch-py using Bulk-API
I'm trying to add a timestamp to my data, have elasticsearch-py bulk index it, and then display the data with kibana.
My data is showing up in kibana, but my timestamp is not being used. When I go to the "Discovery" tab after configuring my index…
CookieEmpire
- 169
- 1
- 9
5
votes
2 answers
Usage of filter_path with helpers.scan in elastisearch client
When doing a search operation in elasticsearch i want the metadata to be filtered out and return only "_source" in the response. I'm able to achieve the same through "search" in the following way:
out1 = es.search(index='index.com',…
Jai Sharma
- 583
- 3
- 16
4
votes
1 answer
Elasticsearch-py Index takes 4 arguments, 5 given?
I have the following call to the Elasticsearch-py client:
esClient.index(index=data['AppName'], id=data['RequestId'], body=data)
I get the following error when I run my code:
Traceback (most recent call last):
File…
danielschnoll
- 1,702
- 3
- 15
- 28
4
votes
1 answer
Version conflict when using the delete method of elasticsearch-dsl
So, we're using elasticsearch in our Django project, and we're using the elasticsearch-dsl python library.
We got the following error in production:
ConflictError(409,…
Daniel
- 383
- 4
- 14
4
votes
1 answer
How set ignore_malformed in index level when creating an index through ElasticSearch DSL python wrapper?
According to docs, this should be sufficient:
"settings": {
"index.mapping.ignore_malformed": true
}
But how can I achieve this on python wrapper? My current code looks like this:
from elasticsearch_dsl import Index
index =…
Montenegrodr
- 1,443
- 10
- 26
4
votes
3 answers
Elasticsearch-dsl sort, find last X entries
I'm trying to find the last 30 entries into my index/doc type
I've tried nothing and I'm all out of ideas!
My current approach I find all the results over the last 5 minutes, then filter through the results and grab out the last 30 entries, but this…
Basil Wallace
- 51
- 1
- 5
4
votes
1 answer
Elasticsearch delay in store and search immediately
I am using elasticsearch with python. and use dsl driver in python.
My script is as below.
import time
from elasticsearch_dsl import DocType, String
from elasticsearch import exceptions as es_exceptions
from elasticsearch_dsl.connections import…
Nilesh
- 17,950
- 11
- 74
- 119
4
votes
0 answers
Python query to Elasticsearch returns 0 hits
I'm trying to query elastic search for all the logs between two milliseconds timestamps.
When querying Elasticsearch directly via:
curl -XPOST ' -d ' {"query" : { "bool" : { "must" : { "range" : { "received_at" : { "gte" :…
Alex
- 151
- 11
4
votes
1 answer
sync/async insert or update ElasticSearch in Python
I'm using ElasticSearch bulk Python API, Does it provide both sync and Async api?
Jack
- 4,626
- 8
- 46
- 98