Questions tagged [elasticsearch-dsl]

elasticsearch provides a full Query DSL based on JSON to define queries. In general, there are basic queries such as term or prefix

elasticsearch provides a full Query DSL based on JSON to define queries. In general, there are basic queries such as term or prefix. There are also compound queries like the bool query. Queries can also have filters associated with them such as the filtered or constant_score queries, with specific filter queries.

Think of the Query DSL as an AST of queries. Certain queries can contain other queries (like the bool query), others can contain filters (like the constant_score), and some can contain both a query and a filter (like the filtered). Each of those can contain any query of the list of queries or any filter from the list of filters, resulting in the ability to build quite complex (and interesting) queries.

http://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl.html

649 questions
530
votes
30 answers

Elasticsearch query to return all records

I have a small database in Elasticsearch and for testing purposes would like to pull all records back. I am attempting to use a URL of the form... http://localhost:9200/foo/_search?pretty=true&q={'matchAll':{''}} Can someone give me the URL you…
John Livermore
  • 26,237
  • 38
  • 112
  • 191
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":…
17
votes
2 answers

aggregate a field in elasticsearch-dsl using python

Can someone tell me how to write Python statements that will aggregate (sum and count) stuff about my documents? SCRIPT from datetime import datetime from elasticsearch_dsl import DocType, String, Date, Integer from elasticsearch_dsl.connections…
VISQL
  • 1,598
  • 4
  • 24
  • 39
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 { …
13
votes
1 answer

Elasticsearch: is bulk search possible?

i know there is support for bulk index operation. but is it possible to do the same for search queries? i want to send many different unrelated queries (to do precision/recall testing) and it would probably be faster using bulk query
piotrek
  • 12,111
  • 8
  • 63
  • 144
10
votes
3 answers

elasticsearch-dsl aggregations returns only 10 results. How to change this

I am using elasticsearch-dsl python library to connect to elasticsearch and do aggregations. I am following code search.aggs.bucket('per_date', 'terms', field='date')\ .bucket('response_time_percentile', 'percentiles', field='total_time', …
hard coder
  • 4,256
  • 4
  • 26
  • 52
10
votes
4 answers

Python elasticsearch-dsl django pagination

How can i use django pagination on elasticsearch dsl. My code: query = MultiMatch(query=q, fields=['title', 'body'], fuzziness='AUTO') s = Search(using=elastic_client, index='post').query(query).sort('-created_at') response = s.execute() // this…
Mirza Delic
  • 3,591
  • 12
  • 46
  • 79
9
votes
1 answer

Elasticsearch range bucket aggregation based on doc_count

I have an elasticsearch aggregation query like this. { "aggs": { "customer": { "aggs": { "Total_Sale": { "sum": { "field": "amount" } …
nitzien
  • 847
  • 7
  • 21
8
votes
2 answers

Index CSV to ElasticSearch in Python

Looking to index a CSV file to ElasticSearch, without using Logstash. I am using the elasticsearch-dsl high level library. Given a CSV with header for example: name,address,url adam,hills 32,http://rockit.com jane,valleys 23,http://popit.com What…
bluesummers
  • 7,494
  • 4
  • 55
  • 85
7
votes
3 answers

How to get exact match phrase more than one

Below is the query to get the exact match GET courses/_search { "query": { "term" : { "name.keyword": "Anthropology 230" } } } I need to find the Anthropology 230 and Anthropology 250 also How to get the exact match
aysh
  • 363
  • 6
  • 15
7
votes
1 answer

Root certificates are missing for certificate validation. Either pass them in using the ca_certs parameter or install certifi to use it automatically

I am using django-elasticsearch-dsl in one of our projects, and after creating a cluster in AWS Elasticsearch, I started seeing this error: Root certificates are missing for certificate validation. Either pass them in using the ca_certs parameter or…
7
votes
1 answer

Indexing and percolating documents with elasticsearch-dsl-py

I'm making and investigation for a seminar in retrieval information. I have a json file with a list of articles and i need to index them and after use a percolator with highlighting. The list of steps for do this in terminal is this: 1. Create a…
7
votes
1 answer

Querying Array data type in elasticsearch using python_dsl

How complex can a query be on an integer array data type? Here is my class in python to inject data into elasticsearch: class Paragraph(DocType): body = Text(analyzer="standard") published_from = Date() lines = Integer() n_paragraph…
g.lahlou
  • 438
  • 2
  • 13
7
votes
1 answer

Unable to locate nested geopoint after updating to elasticsearch 2.3

We use the AWS managed Elasticsearch service and recently upgraded from 1.5 to 2.3. We use the elasticsearch-dsl package in python to build our queries and managed to migrate most of our queries, but geo_distance is broken no matter what I try.…
marklar
  • 73
  • 6
7
votes
2 answers

python elasticsearch-dsl parent child relationship

I started using the python library elasticsearch-dsl. I am trying to implement a parent-child relationship but it is not working: class Location(DocType): name = String(analyzer='snowball', fields={'raw': String(index='not_analyzed')}) …
Renjith
  • 516
  • 1
  • 6
  • 25
1
2 3
43 44