diff --git a/content/develop/interact/search-and-query/query/exact-match.md b/content/develop/interact/search-and-query/query/exact-match.md index 47d8057e9d..0dfd23e21f 100644 --- a/content/develop/interact/search-and-query/query/exact-match.md +++ b/content/develop/interact/search-and-query/query/exact-match.md @@ -53,21 +53,31 @@ FT.SEARCH index "*" FILTER field start end The following examples show you how to query for bicycles with a price of exactly 270 USD: -``` -FT.SEARCH idx:bicycle "@price:[270 270]" -``` - -``` -FT.SEARCH idx:bicycle "@price:[270]" # requires v2.10 -``` - -``` -FT.SEARCH idx:bicycle "@price==270" # requires v2.10 -``` - -``` -FT.SEARCH idx:bicycle "*" FILTER price 270 270 -``` +{{< clients-example query_em em1 >}} +> FT.SEARCH idx:bicycle "@price:[270 270]" +1) (integer) 1 +2) "bicycle:0" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ... + +> FT.SEARCH idx:bicycle "@price:[270]" # requires v2.10 +1) (integer) 1 +2) "bicycle:0" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ... + +> FT.SEARCH idx:bicycle "@price==270" # requires v2.10 +1) (integer) 1 +2) "bicycle:0" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ... + +> FT.SEARCH idx:bicycle "*" FILTER price 270 270 +1) (integer) 1 +2) "bicycle:0" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ... +{{< /clients-example >}} ## Tag field @@ -90,17 +100,39 @@ The curly brackets are mandatory for tag queries. This short example shows you how to query for new bicycles: -``` -FT.SEARCH idx:bicycle "@condition:{new}" -``` +{{< clients-example query_em em2 >}} +> FT.SEARCH idx:bicycle "@condition:{new}" + 1) (integer) 5 + 2) "bicycle:0" + 3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, -74.0610 40.6678, -74.0610 40.7578))\",\"store_location\":\"-74.0060,40.7128\",\"brand\":\"Velorim\",\"model\":\"Jigger\",\"price\":270,\"description\":\"Small and powerful, the Jigger is the best ride for the smallest of tikes! This is the tiniest kids\xe2\x80\x99 pedal bike on the market available without a coaster brake, the Jigger is the vehicle of choice for the rare tenacious little rider raring to go.\",\"condition\":\"new\"}" + 4) "bicycle:5" + 5) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, -0.1778 51.4024, -0.1778 51.5524))\",\"store_location\":\"-0.1278,51.5074\",\"brand\":\"Breakout\",\"model\":\"XBN 2.1 Alloy\",\"price\":810,\"description\":\"The XBN 2.1 Alloy is our entry-level road bike \xe2\x80\x93 but that\xe2\x80\x99s not to say that it\xe2\x80\x99s a basic machine. With an internal weld aluminium frame, a full carbon fork, and the slick-shifting Claris gears from Shimano\xe2\x80\x99s, this is a bike which doesn\xe2\x80\x99t break the bank and delivers craved performance.\",\"condition\":\"new\"}" + 6) "bicycle:6" + 7) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, 2.1767 48.5516, 2.1767 48.9016))\",\"store_location\":\"2.3522,48.8566\",\"brand\":\"ScramBikes\",\"model\":\"WattBike\",\"price\":2300,\"description\":\"The WattBike is the best e-bike for people who still feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one charge. It\xe2\x80\x99s great for tackling hilly terrain or if you just fancy a more leisurely ride. With three working modes, you can choose between E-bike, assisted bicycle, and normal bike modes.\",\"condition\":\"new\"}" + 8) "bicycle:7" + 9) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, 13.3260 52.2700, 13.3260 52.5700))\",\"store_location\":\"13.4050,52.5200\",\"brand\":\"Peaknetic\",\"model\":\"Secto\",\"price\":430,\"description\":\"If you struggle with stiff fingers or a kinked neck or back after a few minutes on the road, this lightweight, aluminum bike alleviates those issues and allows you to enjoy the ride. From the ergonomic grips to the lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. The rear-inclined seat tube facilitates stability by allowing you to put a foot on the ground to balance at a stop, and the low step-over frame makes it accessible for all ability and mobility levels. The saddle is very soft, with a wide back to support your hip joints and a cutout in the center to redistribute that pressure. Rim brakes deliver satisfactory braking control, and the wide tires provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts facilitate setting up the Roll Low-Entry as your preferred commuter, and the BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\",\"condition\":\"new\"}" +10) "bicycle:8" +11) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, 1.9450 41.1987, 1.9450 41.4301))\",\"store_location\":\"2.1734, 41.3851\",\"brand\":\"nHill\",\"model\":\"Summit\",\"price\":1200,\"description\":\"This budget mountain bike from nHill performs well both on bike paths and on the trail. The fork with 100mm of travel absorbs rough terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. The Shimano Tourney drivetrain offered enough gears for finding a comfortable pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. Whether you want an affordable bike that you can take to work, but also take trail in mountains on the weekends or you\xe2\x80\x99re just after a stable, comfortable ride for the bike path, the Summit gives a good value for money.\",\"condition\":\"new\"}" +{{< /clients-example >}} Use double quotes and [DIALECT 2]({{< relref "/develop/interact/search-and-query/advanced-concepts/dialects" >}}#dialect-2) for exact match queries involving tags that contain special characters. As of v2.10, the only character that needs escaping in queries involving double-quoted tags is the double-quote character. Here's an example of using double-quoted tags that contain special characters: -``` -JSON.SET key:1 $ '{"email": "test@redis.com"}' -FT.CREATE idx ON JSON PREFIX 1 key: SCHEMA $.email AS email TAG -FT.SEARCH idx '@email:{"test@redis.com"}' DIALECT 2 -``` +{{< clients-example query_em em3 >}} +> FT.CREATE idx:email ON JSON PREFIX 1 key: SCHEMA $.email AS email TAG +OK +> JSON.SET key:1 $ '{"email": "test@redis.com"}' +OK +> FT.SEARCH idx:email '@email:{"test@redis.com"}' DIALECT 2 +1) (integer) 1 +2) "key:1" +3) 1) "$" + 2) "{\"email\":\"test@redis.com\"}" +{{< /clients-example>}} ## Full-text field @@ -118,6 +150,10 @@ You can't use a phrase that starts with a [stop word]({{< relref "/develop/inter Here is an example for finding all bicycles that have a description containing the exact text 'rough terrain': -``` +{{< clients-example query_em em4 >}} FT.SEARCH idx:bicycle "@description:\"rough terrain\"" -``` \ No newline at end of file +1) (integer) 1 +2) "bicycle:8" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, 1.9450 41.1987, 1.9450 41.4301))\",\"store_location\":\"2.1734, 41.3851\",\"brand\":\"nHill\",\"model\":\"Summit\",\"price\":1200,\"description\":\"This budget mountain bike from nHill performs well both on bike paths and on the trail. The fork with 100mm of travel absorbs rough terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. The Shimano Tourney drivetrain offered enough gears for finding a comfortable pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. Whether you want an affordable bike that you can take to work, but also take trail in mountains on the weekends or you\xe2\x80\x99re just after a stable, comfortable ride for the bike path, the Summit gives a good value for money.\",\"condition\":\"new\"}" +{{< /clients-example >}} \ No newline at end of file diff --git a/content/develop/interact/search-and-query/query/full-text.md b/content/develop/interact/search-and-query/query/full-text.md index 791ffbcad7..98a2f27e00 100644 --- a/content/develop/interact/search-and-query/query/full-text.md +++ b/content/develop/interact/search-and-query/query/full-text.md @@ -46,9 +46,9 @@ Words that occur very often in natural language, such as `the` or `a` for the En The following example searches for all bicycles that have the word 'kids' in the description: -``` +{{< clients-example query_ft ft1 >}} FT.SEARCH idx:bicycle "@description: kids" -``` +{{< /clients-example >}} ## Phrase @@ -73,9 +73,9 @@ The prefix needs to be at least two characters long. Here is an example that shows you how to search for bicycles with a brand that starts with 'ka': -``` +{{< clients-example query_ft ft2 >}} FT.SEARCH idx:bicycle "@model: ka*" -``` +{{< /clients-example >}} ## Word suffix @@ -93,9 +93,9 @@ FT.SEARCH index "*infix*" Here is an example that finds all brands that end with 'bikes': -``` +{{< clients-example query_ft ft3 >}} FT.SEARCH idx:bicycle "@brand:*bikes" -``` +{{< /clients-example >}} ## Fuzzy search @@ -109,12 +109,12 @@ FT.SEARCH index "%word%" The following example finds all documents that contain a word that has a distance of one to the incorrectly spelled word 'optamized'. You can see that this matches the word 'optimized'. -``` +{{< clients-example query_ft ft4 >}} FT.SEARCH idx:bicycle "%optamized%" -``` +{{< /clients-example >}} If you want to increase the maximum word distance to two, you can use the following query: -``` +{{< clients-example query_ft ft5 >}} FT.SEARCH idx:bicycle "%%optamised%%" -``` \ No newline at end of file +{{< /clients-example >}} \ No newline at end of file diff --git a/content/develop/interact/search-and-query/query/geo-spatial.md b/content/develop/interact/search-and-query/query/geo-spatial.md index c0a2d5535c..ff57102ccc 100644 --- a/content/develop/interact/search-and-query/query/geo-spatial.md +++ b/content/develop/interact/search-and-query/query/geo-spatial.md @@ -41,9 +41,9 @@ Allowed units are `m`, `km`, `mi`, and `ft`. The following query finds all bicycle stores within a radius of 20 miles around London: -``` +{{< clients-example query_geo geo1 >}} FT.SEARCH idx:bicycle "@store_location:[-0.1778 51.5524 20 mi]" -``` +{{< /clients-example >}} ## Shape @@ -62,12 +62,12 @@ Here is a more detailed explanation of this query: The following example query verifies if a bicycle is within a pickup zone: -``` +{{< clients-example query_geo geo2 >}} FT.SEARCH idx:bicycle "@pickup_zone:[CONTAINS $bike]" PARAMS 2 bike "POINT(-0.1278 51.5074)" DIALECT 3 -``` +{{< /clients-example >}} If you want to find all pickup zones that are approximately within Europe, then you can use the following query: -``` +{{< clients-example query_geo geo3 >}} FT.SEARCH idx:bicycle "@pickup_zone:[WITHIN $europe]" PARAMS 2 europe "POLYGON((-25 35, 40 35, 40 70, -25 70, -25 35))" DIALECT 3 -``` \ No newline at end of file +{{< /clients-example >}} \ No newline at end of file diff --git a/content/develop/interact/search-and-query/query/range.md b/content/develop/interact/search-and-query/query/range.md index 7f3782a2d2..41823cb567 100644 --- a/content/develop/interact/search-and-query/query/range.md +++ b/content/develop/interact/search-and-query/query/range.md @@ -55,27 +55,89 @@ The examples in this section use a schema with the following fields: The following query finds bicycles within a price range greater than or equal to 500 USD and smaller than or equal to 1000 USD (`500 <= price <= 1000`): -``` -FT.SEARCH idx:bicycle "@price:[500 1000]" -``` +{{< clients-example query_range range1 >}} +> FT.SEARCH idx:bicycle "@price:[500 1000]" +1) (integer) 3 +2) "bicycle:2" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, -87.6848 41.8231, -87.6848 41.9331))\",\"store_location\":\"-87.6298,41.8781\",\"brand\":\"Nord\",\"model\":\"Chook air 5\",\"price\":815,\"description\":\"The Chook Air 5 gives kids aged six years and older a durable and uberlight mountain bike for their first experience on tracks and easy cruising through forests and fields. The lower top tube makes it easy to mount and dismount in any situation, giving your kids greater safety on the trails.\",\"condition\":\"used\"}" +4) "bicycle:5" +5) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, -0.1778 51.4024, -0.1778 51.5524))\",\"store_location\":\"-0.1278,51.5074\",\"brand\":\"Breakout\",\"model\":\"XBN 2.1 Alloy\",\"price\":810,\"description\":\"The XBN 2.1 Alloy is our entry-level road bike \xe2\x80\x93 but that\xe2\x80\x99s not to say that it\xe2\x80\x99s a basic machine. With an internal weld aluminium frame, a full carbon fork, and the slick-shifting Claris gears from Shimano\xe2\x80\x99s, this is a bike which doesn\xe2\x80\x99t break the bank and delivers craved performance.\",\"condition\":\"new\"}" +6) "bicycle:9" +7) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((12.4464 42.1028, 12.5464 42.1028, 12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\",\"store_location\":\"12.4964,41.9028\",\"model\":\"ThrillCycle\",\"brand\":\"BikeShind\",\"price\":815,\"description\":\"An artsy, retro-inspired bicycle that\xe2\x80\x99s as functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn\xe2\x80\x99t suggest taking it to the mountains. Fenders protect you from mud, and a rear basket lets you transport groceries, flowers and books. The ThrillCycle comes with a limited lifetime warranty, so this little guy will last you long past graduation.\",\"condition\":\"refurbished\"}" +{{< /clients-example >}} This is semantically equivalent to: -``` -FT.SEARCH idx:bicycle "*" FILTER price 500 1000 -``` +{{< clients-example query_range range2 >}} +> FT.SEARCH idx:bicycle "*" FILTER price 500 1000 +1) (integer) 3 +2) "bicycle:2" +3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, -87.6848 41.8231, -87.6848 41.9331))\",\"store_location\":\"-87.6298,41.8781\",\"brand\":\"Nord\",\"model\":\"Chook air 5\",\"price\":815,\"description\":\"The Chook Air 5 gives kids aged six years and older a durable and uberlight mountain bike for their first experience on tracks and easy cruising through forests and fields. The lower top tube makes it easy to mount and dismount in any situation, giving your kids greater safety on the trails.\",\"condition\":\"used\"}" +4) "bicycle:5" +5) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, -0.1778 51.4024, -0.1778 51.5524))\",\"store_location\":\"-0.1278,51.5074\",\"brand\":\"Breakout\",\"model\":\"XBN 2.1 Alloy\",\"price\":810,\"description\":\"The XBN 2.1 Alloy is our entry-level road bike \xe2\x80\x93 but that\xe2\x80\x99s not to say that it\xe2\x80\x99s a basic machine. With an internal weld aluminium frame, a full carbon fork, and the slick-shifting Claris gears from Shimano\xe2\x80\x99s, this is a bike which doesn\xe2\x80\x99t break the bank and delivers craved performance.\",\"condition\":\"new\"}" +6) "bicycle:9" +7) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((12.4464 42.1028, 12.5464 42.1028, 12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\",\"store_location\":\"12.4964,41.9028\",\"model\":\"ThrillCycle\",\"brand\":\"BikeShind\",\"price\":815,\"description\":\"An artsy, retro-inspired bicycle that\xe2\x80\x99s as functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn\xe2\x80\x99t suggest taking it to the mountains. Fenders protect you from mud, and a rear basket lets you transport groceries, flowers and books. The ThrillCycle comes with a limited lifetime warranty, so this little guy will last you long past graduation.\",\"condition\":\"refurbished\"}" +{{< /clients-example >}} For bicycles with a price greater than 1000 USD (`price > 1000`), you can use: -``` -FT.SEARCH idx:bicycle "@price:[(1000 +inf]" -``` +{{< clients-example query_range range3 >}} +> FT.SEARCH idx:bicycle "@price:[(1000 +inf]" + 1) (integer) 5 + 2) "bicycle:1" + 3) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-118.2887 34.0972, -118.1987 34.0972, -118.1987 33.9872, -118.2887 33.9872, -118.2887 34.0972))\",\"store_location\":\"-118.2437,34.0522\",\"brand\":\"Bicyk\",\"model\":\"Hillcraft\",\"price\":1200,\"description\":\"Kids want to ride with as little weight as possible. Especially on an incline! They may be at the age when a 27.5\\\" wheel bike is just too clumsy coming off a 24\\\" bike. The Hillcraft 26 is just the solution they need!\",\"condition\":\"used\"}" + 4) "bicycle:4" + 5) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-122.4644 37.8199, -122.3544 37.8199, -122.3544 37.7099, -122.4644 37.7099, -122.4644 37.8199))\",\"store_location\":\"-122.4194,37.7749\",\"brand\":\"Noka Bikes\",\"model\":\"Kahuna\",\"price\":3200,\"description\":\"Whether you want to try your hand at XC racing or are looking for a lively trail bike that's just as inspiring on the climbs as it is over rougher ground, the Wilder is one heck of a bike built specifically for short women. Both the frames and components have been tweaked to include a women\xe2\x80\x99s saddle, different bars and unique colourway.\",\"condition\":\"used\"}" + 6) "bicycle:3" + 7) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((-80.2433 25.8067, -80.1333 25.8067, -80.1333 25.6967, -80.2433 25.6967, -80.2433 25.8067))\",\"store_location\":\"-80.1918,25.7617\",\"brand\":\"Eva\",\"model\":\"Eva 291\",\"price\":3400,\"description\":\"The sister company to Nord, Eva launched in 2005 as the first and only women-dedicated bicycle brand. Designed by women for women, allEva bikes are optimized for the feminine physique using analytics from a body metrics database. If you like 29ers, try the Eva 291. It\xe2\x80\x99s a brand new bike for 2022.. This full-suspension, cross-country ride has been designed for velocity. The 291 has 100mm of front and rear travel, a superlight aluminum frame and fast-rolling 29-inch wheels. Yippee!\",\"condition\":\"used\"}" + 8) "bicycle:6" + 9) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, 2.1767 48.5516, 2.1767 48.9016))\",\"store_location\":\"2.3522,48.8566\",\"brand\":\"ScramBikes\",\"model\":\"WattBike\",\"price\":2300,\"description\":\"The WattBike is the best e-bike for people who still feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one charge. It\xe2\x80\x99s great for tackling hilly terrain or if you just fancy a more leisurely ride. With three working modes, you can choose between E-bike, assisted bicycle, and normal bike modes.\",\"condition\":\"new\"}" +10) "bicycle:8" +11) 1) "$" + 2) "{\"pickup_zone\":\"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, 1.9450 41.1987, 1.9450 41.4301))\",\"store_location\":\"2.1734, 41.3851\",\"brand\":\"nHill\",\"model\":\"Summit\",\"price\":1200,\"description\":\"This budget mountain bike from nHill performs well both on bike paths and on the trail. The fork with 100mm of travel absorbs rough terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. The Shimano Tourney drivetrain offered enough gears for finding a comfortable pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. Whether you want an affordable bike that you can take to work, but also take trail in mountains on the weekends or you\xe2\x80\x99re just after a stable, comfortable ride for the bike path, the Summit gives a good value for money.\",\"condition\":\"new\"}" +{{< /clients-example >}} The example below returns bicycles with a price lower than or equal to 2000 USD (`price <= 2000`) by returning the five cheapest bikes: -``` -FT.SEARCH idx:bicycle "@price:[-inf 2000] SORTBY price LIMIT 0 5" -``` +{{< clients-example query_range range4 >}} +> FT.SEARCH idx:bicycle "@price:[-inf 2000]" SORTBY price LIMIT 0 5 + 1) (integer) 7 + 2) "bicycle:0" + 3) 1) "price" + 2) "270" + 3) "$" + 4) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, -74.0610 40.6678, -74.0610 40.7578))\",\"store_location\":\"-74.0060,40.7128\",\"brand\":\"Velorim\",\"model\":\"Jigger\",\"price\":270,\"description\":\"Small and powerful, the Jigger is the best ride for the smallest of tikes! This is the tiniest kids\xe2\x80\x99 pedal bike on the market available without a coaster brake, the Jigger is the vehicle of choice for the rare tenacious little rider raring to go.\",\"condition\":\"new\"}" + 4) "bicycle:7" + 5) 1) "price" + 2) "430" + 3) "$" + 4) "{\"pickup_zone\":\"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, 13.3260 52.2700, 13.3260 52.5700))\",\"store_location\":\"13.4050,52.5200\",\"brand\":\"Peaknetic\",\"model\":\"Secto\",\"price\":430,\"description\":\"If you struggle with stiff fingers or a kinked neck or back after a few minutes on the road, this lightweight, aluminum bike alleviates those issues and allows you to enjoy the ride. From the ergonomic grips to the lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. The rear-inclined seat tube facilitates stability by allowing you to put a foot on the ground to balance at a stop, and the low step-over frame makes it accessible for all ability and mobility levels. The saddle is very soft, with a wide back to support your hip joints and a cutout in the center to redistribute that pressure. Rim brakes deliver satisfactory braking control, and the wide tires provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts facilitate setting up the Roll Low-Entry as your preferred commuter, and the BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\",\"condition\":\"new\"}" + 6) "bicycle:5" + 7) 1) "price" + 2) "810" + 3) "$" + 4) "{\"pickup_zone\":\"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, -0.1778 51.4024, -0.1778 51.5524))\",\"store_location\":\"-0.1278,51.5074\",\"brand\":\"Breakout\",\"model\":\"XBN 2.1 Alloy\",\"price\":810,\"description\":\"The XBN 2.1 Alloy is our entry-level road bike \xe2\x80\x93 but that\xe2\x80\x99s not to say that it\xe2\x80\x99s a basic machine. With an internal weld aluminium frame, a full carbon fork, and the slick-shifting Claris gears from Shimano\xe2\x80\x99s, this is a bike which doesn\xe2\x80\x99t break the bank and delivers craved performance.\",\"condition\":\"new\"}" + 8) "bicycle:2" + 9) 1) "price" + 2) "815" + 3) "$" + 4) "{\"pickup_zone\":\"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, -87.6848 41.8231, -87.6848 41.9331))\",\"store_location\":\"-87.6298,41.8781\",\"brand\":\"Nord\",\"model\":\"Chook air 5\",\"price\":815,\"description\":\"The Chook Air 5 gives kids aged six years and older a durable and uberlight mountain bike for their first experience on tracks and easy cruising through forests and fields. The lower top tube makes it easy to mount and dismount in any situation, giving your kids greater safety on the trails.\",\"condition\":\"used\"}" +10) "bicycle:9" +11) 1) "price" + 2) "815" + 3) "$" + 4) "{\"pickup_zone\":\"POLYGON((12.4464 42.1028, 12.5464 42.1028, 12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\",\"store_location\":\"12.4964,41.9028\",\"model\":\"ThrillCycle\",\"brand\":\"BikeShind\",\"price\":815,\"description\":\"An artsy, retro-inspired bicycle that\xe2\x80\x99s as functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn\xe2\x80\x99t suggest taking it to the mountains. Fenders protect you from mud, and a rear basket lets you transport groceries, flowers and books. The ThrillCycle comes with a limited lifetime warranty, so this little guy will last you long past graduation.\",\"condition\":\"refurbished\"}" +{{< /clients-example >}} ## Non-numeric range queries diff --git a/content/operate/rs/references/rest-api/requests/cluster/actions.md b/content/operate/rs/references/rest-api/requests/cluster/actions.md index 509c33f70c..feb130bdaa 100644 --- a/content/operate/rs/references/rest-api/requests/cluster/actions.md +++ b/content/operate/rs/references/rest-api/requests/cluster/actions.md @@ -138,6 +138,17 @@ removed as soon as the new one is submitted. |-------|------|-------------| | action | string | The name of the action required. | +Supported cluster actions: + +- `change_master`: Promotes a specified node to become the primary node of the cluster, which coordinates cluster-wide operations. Include the `node_uid` of the node you want to promote in the request body. + + ```sh + POST /v1/cluster/actions/change_master + { + "node_uid": "2" + } + ``` + ### Response {#post-response} The body content may provide additional action details. Currently, it is not used. diff --git a/content/operate/rs/references/rest-api/requests/nodes/status.md b/content/operate/rs/references/rest-api/requests/nodes/status.md index 50956ea4e9..e7db1e1fc2 100644 --- a/content/operate/rs/references/rest-api/requests/nodes/status.md +++ b/content/operate/rs/references/rest-api/requests/nodes/status.md @@ -48,23 +48,43 @@ Gets the status of all nodes. Includes each node's hostname and role in the clus ### Response {#get-all-response} -For each node in the cluster, returns a JSON object that contains the node's hostname and role. +For each node in the cluster, returns a JSON object that contains each node's hostname, role, and other status details. + +If a maintenance snapshot exists due to an in-progress or improperly stopped [node maintenance]({{}}) process, the response includes a `maintenance_snapshot` field. #### Example JSON body ```json { "1": { + "cores": 8, + "free_provisional_ram": 0, + "free_ram": 3499368448, "hostname": "3d99db1fdf4b", - "role": "master" + "maintenance_snapshot": { + "created_time": "2024-09-06 20:47:23", + "name": "maintenance_mode_2024-09-06_20-47-23", + "node_uid": "1" + }, + "master_shards": [], + "node_overbooking_depth": 0, + "node_status": "active", + "role": "master", + "slave_shards": [], + "software_version": "7.4.6-22", + "software_version_sha": "6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831", + "total_memory": 6219673600, + "total_provisional_ram": 0 }, "2": { "hostname": "fc7a3d332458", - "role": "slave" + "role": "slave", + // additional fields }, "3": { "hostname": "b87cc06c830f", - "role": "slave" + "role": "slave", + // additional fields } } ``` @@ -116,14 +136,32 @@ Gets the status of a node. Includes the node's hostname and role in the cluster: ### Response {#get-response} -Returns a JSON object that contains the node's hostname and role. +Returns a JSON object that contains the node's hostname, role, and other status details. + +If a maintenance snapshot exists due to an in-progress or improperly stopped [node maintenance]({{}}) process, the response includes a `maintenance_snapshot` field. #### Example JSON body ```json { + "cores": 8, + "free_provisional_ram": 0, + "free_ram": 3504422912, "hostname": "3d99db1fdf4b", - "role": "master" + "maintenance_snapshot": { + "created_time": "2024-09-06 20:47:23", + "name": "maintenance_mode_2024-09-06_20-47-23", + "node_uid": "1" + }, + "master_shards": [], + "node_overbooking_depth": 0, + "node_status": "active", + "role": "master", + "slave_shards": [], + "software_version": "7.4.6-22", + "software_version_sha": "6c37b1483b5fb6110c8055c1526aa58eec1d29d3519e92310859101419248831", + "total_memory": 6219673600, + "total_provisional_ram": 0 } ```