Learning Elasticsearch by Abhishek Andhavarapu

Learning Elasticsearch by Abhishek Andhavarapu

Author:Abhishek Andhavarapu [Andhavarapu, Abhishek]
Language: eng
Format: azw3, pdf
Tags: COM021040 - COMPUTERS / Databases / Data Warehousing, COM021050 - COMPUTERS / Databases / Servers, COM018000 - COMPUTERS / Data Processing
Publisher: Packt Publishing
Published: 2017-06-30T04:00:00+00:00


Querying based on range

Range query can be used on numbers and dates to query for all the documents in a given range.

Range query supports the following operators:

lt: < less than operator

gt: > greater than operator

lte: <= less than or equal to operator

gte: >= greater than or equal to operator

An SQL query to query all the products greater than 70 and less than 100 is shown here:

select * from product where unitprice > 70 and unitprice <= 100

The preceding query can be written using a range query as shown here:

POST chapter6/_search

{

"query": {

"range": {

"unit_price": {

"gt": 70,

"lte": 100

}

}

}

}

Similarly, a range query can also be used on dates as shown here:

POST chapter6/_search

{

"query": {

"range": {

"release_date": {

"gt": "2017-01-01",

"lte": "now"

}

}

}

}

We will discuss how to query dates in detail in the next section.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.