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 : Search with special character Open & Close parentheses

Hi I am trying to search a word which has these characters in it '(' , ')' in elastic search. I am not able to get expected result. This is the query I am using { "query": { "query_string" : { "default_field" : "name", "query" :…
Ramesh
  • 1,872
  • 2
  • 20
  • 33
0
votes
1 answer

Elastic Search: Query on multiple fields

I have JSON document in elastic search as follows { "animals": [ { "id": 1, "name": "cat" }, { "id": 2, "name": "dog" }, { "id": 3, "name": "rabbit" } ] } How to query return this…
rahul
  • 6,447
  • 3
  • 31
  • 42
0
votes
2 answers

How can I find all documents in elasticsearch that contain a number in a certain field?

I have a keyword type'd field that can contain either a number or a string. If the field does not contain any letters, I would like to hit on that document. How can I do this? My index mapping looks like: { "mappings": { "Entry": { …
Grammin
  • 11,808
  • 22
  • 80
  • 138
0
votes
1 answer

How to write an at-least-N-terms query together with filter and must_not in Elasticsearch?

I want to match documents satisfying all the conditions below: author == "tom" status != "deleted" at least two of f1-f4 fields match given values (all fields are keyword) {"size":24, "query":{ "bool":{ …
ProtossShuttle
  • 1,623
  • 20
  • 40
0
votes
1 answer

Query elasticsearch where a key's value is at least some number

I am processing files to recognize if they contain labels and what the confidence the label was recognized. I created a nested mapping called tags which contains label (text) and confidence (float between 0 and 100). Here is an example of how I…
0
votes
1 answer

ElasticSearch: Restrict Aggregations to Query String

I'm struggling to get my aggregations to be restricted to my query. I, of course, tried: { "_source": ["burger.id", "burger.user_name", "burger.timestamp"], "query": { "query_string": { "query": "burger.user_name:Bob" …
0
votes
1 answer

is there a way to write a boolean query with different conditions in elasticsearch?

Ive setted up elasticsearch with a NodeJS Server and need a working boolean query that checks different conditions in the search. How to do that? I am using mongoosastic(query DSL) with NodeJS and the following query to get the results mapping…
0
votes
1 answer

Elasticsearch : How to get count of child nested objects with parent field?

I have one scenario for retrieving millions of records from elastic search. I am a beginner at Elastic-search and not able to use elastic search very efficiently. I am indexing Author Model as shown below in elastic search and I am using NEST Client…
Karan Shah
  • 71
  • 7
0
votes
1 answer

Elastic search query for name / value pair columns pull

We have one document in elastic search with multiple sections of name/value pair and we want to fetch value's only based on name column value. "envelopeData": { "envelopeName": "Bills", "details": { "detail": [ { "name":…
0
votes
1 answer

Elasticsearch Query + Agg search query

Data in my elasticsearch contains a field named facilityName. I have a requirement where I have to see if there are any duplicate records with facilityNameTypeCode as "UWI" and having same facilityName value. Following is a structure example: …
0
votes
0 answers

Elasticsearch apply query filter on nested list filtering out unmatched nested objects

I have an document that contains a nested list of objects. I would like to create a query to return the documents that contain certain nested element, but also limit the resulted list of nested elements to those that meet the conditions. For…
andreyro
  • 935
  • 12
  • 18
0
votes
1 answer

How to express optional matching using Query String Query

I have a query as below using the query string dsl which I'm expecting to return results that match all the three assertions. (status = active, price = 100 , language = en). How can I make the language param optional, just score lower if is not…
mike
  • 533
  • 1
  • 7
  • 24
0
votes
2 answers

Generate elastic search AND query based upon list size i.e no. of AND's in the query will be based on no. of items in the list

I have a list whose size is not fixed and can contain any no. of items. Based on the number of items in the list, I have to generate an elastic search AND query to find the exact match of values. For eg: If my list contains 2 items : ['a', 'b'], my…
0
votes
1 answer

Elastic search query find exact match of values in the list from regexp input parameter

My data looks like below: { "name": "name1", "name_gr": ["gr1","gr2"] }, { "name": "name2", "name_gr": ["gr1","gr2"] }, { "name": "name3", "name_gr": ["gr2","gr3"] }, { "name": "name4", "name_gr":…
0
votes
1 answer

finding multiple exact values using elastic search query

I have inserted some data like below in elastic search. The data (name_list) looks like below. { "manage": { "name_list": [ { "name": "name1", "name_gr": ["gr1","gr2"] }, { "name": "name2", …