Python's official low-level client for Elasticsearch
Questions tagged [elasticsearch-py]
194 questions
0
votes
1 answer
Elasticsearch match query with partial text match
Newbie question on elasticsearch. I have set up the elasticsearch lucene index and use searching for names that contain some term, such as
search_response = es.search(index = 'sample', body = {'query':{'match':{'first_name':"JUST"}}})
This does not…

DonDyck
- 1,451
- 5
- 20
- 35
0
votes
2 answers
Elasticsearch build dynamic query - python
A newbie question on elasticsearch-py api. I built an index of records of name, address, phone number etc and I can query using the python client
eg.
`elasticsearch.search(index = "index_name", q= 'first_name:"JOHN"')`
and get the appropriate…

DonDyck
- 1,451
- 5
- 20
- 35
0
votes
0 answers
doc_freq increases as I call update API in Elasticsearch-Py
I have exactly 100 documents were already indexed in Elasticsearch and I need to update each document by adding a new simple field using the following function:
def add_new_field( ):
ES_HOST = {"host" : "localhost", "port" : 9200}
ES=…

K.Ali
- 283
- 4
- 15
0
votes
1 answer
How do I filter by geo-distance in elasticsearch-py?
Using Python 2.7 and elasticsearch-py.
Given the following JSON:
[
{
"Name":
"Addresses": [
"StreetAdd": "xxx",
"GeoLocation": {
"lat": xx,
"long": yy
}
…

WGS
- 13,969
- 4
- 48
- 51
0
votes
1 answer
How to make elastic increase a counter on every update?
I want to create a (url,visits) index on elasticsearch which will hold the number of visits a particular url every time I call function myfunction. How can I do that? So far, I have managed to create the insertion but I am unable to increase the…

user706838
- 5,132
- 14
- 54
- 78
0
votes
1 answer
ElasticSearch ConnectionPool using elasticsearch-py library
I am a novice in ElasticSearch, and trying to add entries to an index in ElasticSearch using concurrent connections from the ElasticSearch ConnectionPool [via the Transport class].
Here is my code:
import elasticsearch
from elasticsearch.transport…

Sameer Mirji
- 2,135
- 16
- 28
0
votes
0 answers
aggregate queries using elasticsearch-py
I'm trying the following aggregate query using elasticsearch-py version 2.1.0 to query an elasticsearch instance of version 2.1.1.
{
"query": {
"filtered": {
"filter": { "term": {"applicationType":"myapptype"} }
}
},
…

user3760679
- 41
- 3
0
votes
1 answer
Does Elasticsearch-py sanitize queries?
I'm new to ES and wondering if the search function sanitizes the inner "query" field in the body parameter when handed something like:
"query": {
"filtered": {
"query": {
"match": {
"_all": {
…

James E
- 1
- 1
0
votes
1 answer
Remove default 'match_all' query from Elasticseacrch-dsl-py
How can I remove 'match_all' from the the following query:
es = Elasticsearch()
s = Search(es)
s = s.filter("term", status="Free")
s.to_dict()
{'query': {'filtered': {'filter': {'term': {'status': 'Free'}}, 'query': {'match_all': {}}}}}

Shipra
- 1,259
- 2
- 14
- 26
0
votes
1 answer
How to get aggs in elasticsearch-dsl-py
How can I get result of an aggregation?
My code is:
s = Items.search() #Items is DSL class
s.aggs.bucket('SP', 'terms', item=item_name).metric('max_amt', 'max', field='amount')
res = s.execute()
When trying this, I'm getting following error:
…

Shipra
- 1,259
- 2
- 14
- 26
0
votes
0 answers
ElasticSearch automatic typing
I would like to search in products codes - mix of chars and numbers (for example: A210/444, Alexx 1982 X, ...). (Btw: Have anybody some best-practices for searching in this type of data?)
I have a index with index_analyzer and search_analyzer:
{
…

Dingo
- 2,656
- 1
- 19
- 16
0
votes
1 answer
Elasticsearch analyze() not compatible with Spark in Python?
I'm using the elasticsearch-py client within PySpark using Python 3 and I'm running into a problem using the analyze() function with ES in conjunction with an RDD. In particular, each record in my RDD is a string of text and I'm trying to analyze it…

plam
- 1,305
- 3
- 15
- 24
0
votes
1 answer
Getting Parse error for elasticsearch-py
I am trying to search my entire elasticsearch data for a certain word "tsbu" within a time range. When I try running this, I get a SearchParseException and Parse Failure.
es = Elasticsearch()
doc = {
"query": {
"match" : {
…

lezzago
- 271
- 1
- 6
- 15
-1
votes
1 answer
Python get data from Elasticsearch
I have a json log of modsecurity nginx. I have sent it to Elasticsearch.
Now I want write a python script to get data from Elasticsearch and use this to trigger Zabbix monitor.
But I am confused with this. Here is my data when I get it to…

ThanhLam112358
- 878
- 1
- 20
- 51