Questions tagged [elasticsearch-query]

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.

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.

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.

634 questions
0
votes
1 answer

elasticsearch - find document by exactly matching a nested object

I have documents that contain multiple role/right definitions as an array of nested objects: { ... 'roleRights': [ {'roleId':1, 'right':1}, {'roleId':2, 'right':1}, {'roleId':3, 'right':2}, ] } I am trying to filter out document…
Philipp
  • 4,180
  • 7
  • 27
  • 41
0
votes
0 answers

ElasticSearch - Get first document with distinct field

I only want to get one document from many that have the same field value. The following documents are indexed: { "name": "John", "position": 1 }, { "name": "Ben", "position": 1 } When making a search request for the term position…
0
votes
2 answers

Elasticsearch Multi-field Query

I have configured an Elasticsearch index with two fields : "Name" and "Type". When I execute the query below, I don't get any result because "actor" is in the "Type" field. { "query": { "multi_match": { "query": "johnny depp actor", …
Mahdi DIF
  • 159
  • 1
  • 10
0
votes
1 answer

Deep Elasticsearch wildcard query for given time range and with AND operator

I managed to build query that matches all exact values in given time range supports and operator. Now I want to extend the query to support partial matching but I struggle to do that. Any advice would be appreciated. Mapping "event": { …
rebeliagamer
  • 1,257
  • 17
  • 33
0
votes
0 answers

Local elasticsearch host blocking request with enabled request header from angularJS

I am trying to post a request to a local elasticsearch. I have configured the elasticsearch.yml to include: http.cors.enabled: true http.cors.allow-origin: "*" http.cors.allow-headers: "X-Requested-With, Content-Type, Content-Length,…
Patidati
  • 1,048
  • 2
  • 12
  • 19
0
votes
1 answer

Aggregation in elasticsearch with specific parameter

I have bulk documents in elasticsearch and as an example I have taken the elasticsearch documentation example as banks { "_index": "bank", "_type": "account", "_id": "25", "_score": 1, "_source": { "account_number": 25, "balance":…
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,244
  • 3
  • 16
  • 38
0
votes
1 answer

elasticsearch query for parameter(string) with multiple values

I have the dump of elasticsearch in which a field named as "journey" under that i have multiple values like, Indian, Australia, Dubai etc.,. I need to write a query for which i will provide list of journey values that are to be returned (like India…
Rockon
  • 1
  • 1
0
votes
2 answers

Elasticsearch - get documents which have a field name

Lets say I am putting documents in elastic search as following: { "name": "xyz", "address": { "pincode": "111111", "area": "downtown" } } I want to get all the documents which have pincode in them. Ofcourse, some documents entered in ES…
spiralarchitect
  • 880
  • 7
  • 19
0
votes
2 answers

Partial search not working on Elasticsearch+Haystack in spite of using Ngram and Edgengram for building index

I am building the indexes like : class BookIndex(indexes.SearchIndex,indexes.Indexable): text= indexes.EdgeNgramField(document=True,use_template=True) content_auto = indexes.EdgeNgramField(model_attr='title') isbn_13 =…
0
votes
0 answers

ElasticSearch: Add variable for build dynamic query in Elastic (PHP)

I want to put the half of query in variable $query and put it in $params in ElasticSearch. This is my $query : if (Input::has('_id')) { $_id = $this->input['_id']; $path = 'data'; $field = 'data.city'; //…
Lazy Guy
  • 101
  • 2
  • 14
0
votes
1 answer

How can I find exactly phrase with an array field in Elasticsearch?

I have index with field singers mapping like: "singers": { "type": "string", "index_name": "singer", "analyzer": "unicode_analyzer" } Example data like: "singers": [ "Đàm Vĩnh Hưng", "Thanh Lam (NSƯT)" ] Now I want to find if…
0
votes
1 answer

elasticsearch specific hours

I am trying to write a query that will only return results for the current hour in the day, x days back. for instance if the time now is 12:00 I want to get the results in range 11:00-12:00 for each day, 14 days back. I have seen Elasticsearch sum…
0
votes
1 answer

Elasticsearch slow search query performance

I'm having a lot of issues tuning Elasticsearch to give a high search query performance. These are my specs: ES Setup: Version: 0.90.0, 2 nodes (m3.2xlarge aws intances) in cluster, 32GB RAM each, 50% allocated to ES_HEAP_SIZE, no…
alpha_cod
  • 1,933
  • 5
  • 25
  • 43
0
votes
1 answer

Conditionally adding term filters to elasticsearch filter query

I've been wondering how to go about checking if a search parameter is not empty before actually adding that term filter to a filtered query. From my limited experience with elasticsearch, it seems like I have to build my exact query ahead of time.…
K.B. Choi
  • 13
  • 1
  • 8