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
0
votes
1 answer

How to link Pycharm with elasticsearch-py

I have installed elasticsearch 2.3.3 on ubuntu 15.10. I am switching from intellij to Pycharm 2016.1.4. How can i configure pycharm such a way that use libraries such as elasticsearch-dsl?
0
votes
1 answer

Create filter queries by hand using elasticsearch_dsl

I am trying to build arbitrary nested queries stored in a some data structures (possibly a tree). From the manual I gather that filter type of queries are special types of Bool queries, so that s = Search() s = s.filter('terms', tags=['search',…
meto
  • 2,479
  • 5
  • 28
  • 41
0
votes
1 answer

How to handle wildcards in elastic search structured queries

My use case requires to query for our elastic search domain with trailing wildcards. I wanted to get your opinion on the best practices of handling such wildcards in the queries. Do you think adding the following clauses is a good practice for the…
Adi GuN
  • 1,074
  • 2
  • 11
  • 36
0
votes
1 answer

Nested SQL select using elasticsearch

How can I write this in elasticsearch: SELECT avg(sum) FROM ( SELECT sum(rev) as sum FROM table GROUP BY user_id )
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,049
  • 2
  • 11
  • 24
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: …
0
votes
1 answer

elasticsearch aggregation with date comparision and calcul

Hi i am kinda new to elasticsearch. I need to get an aggregation with date comparison and a dynamic range filter. Like i need to get documents count where created_at document is 1 week earlier than their identification_date. So i tried something…
0
votes
0 answers

I'm trying to use Elasticsearch for finding the overlap of two tag sets

Given a person with a number of tags and a book with a number of tags, I want to find the best book for that person. The problem that I'm having with elasticsearch is that with the scoring mechanisms, it looks like a book with one tag takes…
gkp
  • 76
  • 3
0
votes
0 answers

Elasticsearch DSL queries not finding results

I'm working on setting up Elasticsearch DSL for a django project. When I use Elasticsearch DSL to set up the index and doc_type everything works. I use sense(chrome plugin) and cURL to double-check if the index and doc_type mapping is added, and…
0
votes
1 answer

Get word frequency in Elasticsearch with large document

i have been trying to get word frequency in Elasticsearch. I using Elasticsearch Python and Elasticsearch DSL Python Client. here is my code: client = Elasticsearch(["my_ip_machine:port"]) s = Search(using=client, index=settings.ES_INDEX) \ …
kandito
  • 19
  • 2
0
votes
2 answers

Elasticsearch find all messages that were 'delivered' but not 'opened'

I have the following elasticsearch index data: id|message_id| action| 1| 1|delivered| 2| 1| opened| 3| 2|delivered| 4| 3|delivered| 5| 4|delivered| 6| 5| opened| How to find all 'not…
Anton
  • 875
  • 8
  • 17
0
votes
1 answer

Elasticsearch: exclude results if other record exists

I have the following elasticsearch index structure: id|action|user_id|message_id 1| click| 1| 1 2| open| 1| 1 3| click| 2| 1 4| open| 2| 1 5| click| 1| 2 6| click| 1| …
Anton
  • 875
  • 8
  • 17
0
votes
1 answer

How to construct msearch API query with aggregations for Elasticsearch

Elasticsearch documentation describes a way to build a simple query body for msearch API query. But if you use aggregations this no longer works either using curl or any version of elasticsearch-py library. Github corresponding ticket. Example…
rom85
  • 86
  • 5
-1
votes
2 answers

Date histogram aggregation Elasticsearch

I want to filter and get data from elastic search. where I have tried Date histogram aggregation but its not solving my purposes. I have data like: [ { "id":1, "title":"Sample news", "date":"2020-09-17", "regulation":[ …
-1
votes
1 answer

Python : wildcard query in Elasticsearch

I want to query a field using wildcard in Elasticsearch but the problem is that the search string is stored in a variable and not available statically. The intended query is : body={"query": {"wildcard": {"Name": { "value" : "Vi?????" }}}} where…
1 2 3
43
44