url
stringlengths 38
157
| content
stringlengths 72
15.1M
|
---|---|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/cluster/policy/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Cluster policy requests
</h1>
<p class="text-lg -mt-5 mb-10">
Cluster policy requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-cluster-policy">
GET
</a>
</td>
<td>
<code>
/v1/cluster/policy
</code>
</td>
<td>
Get cluster policy settings
</td>
</tr>
<tr>
<td>
<a href="#put-cluster-policy">
PUT
</a>
</td>
<td>
<code>
/v1/cluster/policy
</code>
</td>
<td>
Update cluster policy settings
</td>
</tr>
</tbody>
</table>
<h2 id="get-cluster-policy">
Get cluster policy
</h2>
<pre><code>GET /v1/cluster/policy
</code></pre>
<p>
Gets the cluster's current policy settings.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_cluster_info">
view_cluster_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /cluster/policy
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns a
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster_settings/">
cluster settings object
</a>
.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"db_conns_auditing"</span><span class="p">:</span> <span class="kc">false</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_non_sharded_proxy_policy"</span><span class="p">:</span> <span class="s2">"single"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_provisioned_redis_version"</span><span class="p">:</span> <span class="s2">"6.0"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_sharded_proxy_policy"</span><span class="p">:</span> <span class="s2">"single"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_shards_placement"</span><span class="p">:</span> <span class="s2">"dense"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"redis_upgrade_policy"</span><span class="p">:</span> <span class="s2">"major"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok">
200 OK
</a>
</td>
<td>
Success
</td>
</tr>
</tbody>
</table>
<h2 id="put-cluster-policy">
Update cluster policy
</h2>
<pre><code>PUT /v1/cluster/policy
</code></pre>
<p>
Update cluster policy settings.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#update_cluster">
update_cluster
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="put-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>PUT /cluster/policy
</code></pre>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_shards_placement"</span><span class="p">:</span> <span class="s2">"sparse"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"default_sharded_proxy_policy"</span><span class="p">:</span> <span class="s2">"all-nodes"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="request-body">
Request body
</h4>
<p>
Include a
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster_settings/">
cluster settings object
</a>
with updated fields in the request body.
</p>
<h3 id="put-response">
Response
</h3>
<p>
Returns a status code that indicates the success or failure of the cluster settings update.
</p>
<h3 id="put-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-200-ok">
200 OK
</a>
</td>
<td>
Success
</td>
</tr>
<tr>
<td>
<a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request">
400 Bad Request
</a>
</td>
<td>
Failed to set parameters
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/cluster/policy/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redis-py/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Python client for Redis
</h1>
<p class="text-lg -mt-5 mb-10">
Learn how to build with Redis and Python
</p>
<p>
Connect your Python application to a Redis database using the redis-py client library.
</p>
<p>
Refer to the complete
<a href="/docs/latest/develop/clients/redis-py/">
Python guide
</a>
to install, connect, and use redis-py.
</p>
<nav>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-py/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/flushall/.html | <section class="prose w-full py-12">
<h1 class="command-name">
FLUSHALL
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FLUSHALL [ASYNC | SYNC]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
1.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the total number of keys in all databases
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@keyspace
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@dangerous
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Delete all the keys of all the existing databases, not just the currently selected one.
This command never fails.
</p>
<p>
By default,
<code>
FLUSHALL
</code>
will synchronously flush all the databases.
Starting with Redis 6.2, setting the
<strong>
lazyfree-lazy-user-flush
</strong>
configuration directive to "yes" changes the default flush mode to asynchronous.
</p>
<p>
It is possible to use one of the following modifiers to dictate the flushing mode explicitly:
</p>
<ul>
<li>
<code>
ASYNC
</code>
: flushes the databases asynchronously
</li>
<li>
<code>
SYNC
</code>
: flushes the databases synchronously
</li>
</ul>
<h2 id="notes">
Notes
</h2>
<ul>
<li>
An asynchronous
<code>
FLUSHALL
</code>
command only deletes keys that were present at the time the command was invoked. Keys created during an asynchronous flush will be unaffected.
</li>
<li>
This command does not delete functions.
</li>
</ul>
<h2 id="behavior-change-history">
Behavior change history
</h2>
<ul>
<li>
<code>
>= 6.2.0
</code>
: Default flush behavior now configurable by the
<strong>
lazyfree-lazy-user-flush
</strong>
configuration directive.
</li>
</ul>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#simple-strings">
Simple string reply
</a>
:
<code>
OK
</code>
.
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 4.0.0: Added the
<code>
ASYNC
</code>
flushing mode modifier.
</li>
<li>
Starting with Redis version 6.2.0: Added the
<code>
SYNC
</code>
flushing mode modifier.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/flushall/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/security/access-control/saml-sso/saml-integration-ping-identity/.html | <section class="prose w-full py-12 max-w-none">
<h1>
PingIdentity SAML integration guide
</h1>
<p class="text-lg -mt-5 mb-10">
This integration guide shows how to set up PingIndentity as a SAML single sign-on provider for your Redis Cloud account.
</p>
<p>
This guide shows how to configure
<a href="https://docs.pingidentity.com/p/en-us/makeitwork#top">
PingIdentity
</a>
as a SAML single sign-on identity provider (IdP) for your Redis Cloud account.
</p>
<p>
To learn more about Redis Cloud support for SAML, see
<a href="/docs/latest/operate/rc/security/access-control/saml-sso/">
SAML single sign-on
</a>
.
</p>
<p>
Before completing this guide, you must
<a href="/docs/latest/operate/rc/security/access-control/saml-sso/#verify-domain">
verify ownership of any domains
</a>
you want to associate with your SAML setup.
</p>
<h2 id="step-1-set-up-your-identity-provider-idp">
Step 1: Set up your identity provider (IdP)
</h2>
<h3 id="add-the-redisaccountmapping-attribute">
Add the
<code>
redisAccountMapping
</code>
attribute
</h3>
<ol>
<li>
<p>
Log in into your Ping Identity account. Open
<strong>
Administrators > Identities > User Attributes
</strong>
and select
<strong>
Add Attribute
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_1.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_1.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_1.png"/>
</a>
</li>
<li>
<p>
Select the
<strong>
DECLARED
</strong>
attribute type.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_2.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_2.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_2.png"/>
</a>
</li>
<li>
<p>
Fill in the fields with the following values:
</p>
<ul>
<li>
<strong>
Name
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Display name
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Description
</strong>
:
<code>
redisAccountMapping
</code>
</li>
</ul>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_3.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_3.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_3.png"/>
</a>
<p>
Select
<strong>
Save and Close
</strong>
. Then, verify that the attribute was created successfully.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_4.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_4.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_4.png"/>
</a>
</li>
</ol>
<h3 id="add-the-user-who-will-activate-saml-in-service-manager-redis-cloud">
Add the user who will activate SAML in Service Manager (Redis Cloud)
</h3>
<ol>
<li>
<p>
Go to
<strong>
Administrators > Identities > Users
</strong>
and select
<strong>
Add User
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_5.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_5.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_5.png"/>
</a>
</li>
<li>
<p>
Fill in the following information:
</p>
<ul>
<li>
<strong>
redisAccountMapping
</strong>
:
<code>
{accountID}={role}
</code>
</li>
</ul>
<p>
<strong>
accountID
</strong>
is the account ID from
<a href="/docs/latest/operate/rc/accounts/account-settings/">
account settings
</a>
and
<strong>
role
</strong>
represents the role that the user will be assigned in Redis Cloud console (owner, member, manager, billing_admin, or viewer):
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_6.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_6.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_6.png"/>
</a>
<p>
Save and check that the user was added successfully.
</p>
</li>
</ol>
<h3 id="create-the-ping-identity-saml-application">
Create the Ping Identity SAML application
</h3>
<ol>
<li>
<p>
Go to
<strong>
Administrators > Connections > Applications
</strong>
and select
<strong>
+
</strong>
to add a new application.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_7.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_7.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_7.png"/>
</a>
</li>
<li>
<p>
Choose a name for the application, select
<strong>
SAML Application Type
</strong>
and select
<strong>
Configure
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_8.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_8.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_8.png"/>
</a>
</li>
<li>
<p>
In the ACS URLs and Entity ID field add for now some dummy data, like
<a href="https://example.com">
https://example.com
</a>
</p>
<ul>
<li>
This data will be updated with the correct data in a subsequent step.
</li>
</ul>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_9.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_9.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_9.png"/>
</a>
<p>
Select
<strong>
Save
</strong>
.
</p>
</li>
<li>
<p>
Go to the
<strong>
Configuration
</strong>
tab and save the following information:
</p>
<ul>
<li>
Issuer ID
</li>
<li>
Single Logout Service
</li>
<li>
Single Signon Service
</li>
</ul>
<p>
This information will be needed once we configure SAML in the Redis Cloud console.
</p>
<ul>
<li>
Select
<strong>
Download Metadata
</strong>
. An XML file will be downloaded. Open it and copy the certificate, which is required for the configuration in Redis Cloud console.
</li>
</ul>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_10.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_10.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_10.png"/>
</a>
</li>
<li>
<p>
Go to the
<strong>
Attribute Mappings
</strong>
tab. Add the following attributes:
</p>
<ul>
<li>
saml_subject
</li>
<li>
Email
</li>
<li>
FirstName
</li>
<li>
LastName
</li>
<li>
redisAccountMapping
</li>
</ul>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_11.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_11.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_11.png"/>
</a>
</li>
</ol>
<h2 id="step-2-configure-saml-support-in-redis-cloud">
Step 2: Configure SAML support in Redis Cloud
</h2>
<p>
Now that we have our Ping Identity IdP server ready, we need to configure support for SAML in Redis Cloud.
</p>
<h3 id="sign-in-to-redis-cloud">
Sign in to Redis Cloud
</h3>
<p>
Sign in to your account on the
<a href="https://cloud.redis.io/#/login">
Redis Cloud console
</a>
.
</p>
<h3 id="activate-saml-in-access-management">
Activate SAML in access management
</h3>
<p>
To activate SAML, you must have a local user (or social sign-on user) with the
<strong>
owner
</strong>
role. If you have the correct permissions, you will see the
<strong>
Single Sign-On
</strong>
tab.
</p>
<ol>
<li>
<p>
Fill in the information you copied previously, including:
</p>
<ul>
<li>
<strong>
Issuer (IdP Entity ID)
</strong>
:
<code>
Issuer ID
</code>
</li>
<li>
<strong>
IdP server URL
</strong>
:
<code>
Single Signon Service
</code>
</li>
<li>
<strong>
Single logout URL
</strong>
:
<code>
Single Logout Service
</code>
</li>
<li>
<strong>
Assertion signing certificate
</strong>
: Certificate info you copied from the Ping Identity XML file
</li>
</ul>
<p>
Also add:
</p>
<ul>
<li>
<strong>
Email domain binding
</strong>
: The domain used in your company's email addresses
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_1.png" sdata-lightbox="/images/rc/saml/sm_saml_1.png">
<img src="/docs/latest/images/rc/saml/sm_saml_1.png"/>
</a>
<p>
Select
<strong>
Enable
</strong>
and wait a few seconds for the status to change.
</p>
</li>
<li>
<p>
You will then be able to
<strong>
Download
</strong>
the service provider (SP) metadata. Save the file to your local hard disk.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_3.png" sdata-lightbox="/images/rc/saml/sm_saml_3.png">
<img src="/docs/latest/images/rc/saml/sm_saml_3.png"/>
</a>
</li>
<li>
<p>
Open the file in any text editor. Save the following text from the metadata:
</p>
<ul>
<li>
<strong>
EntityID
</strong>
: The unique name of the service provider (SP)
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_4.png" sdata-lightbox="/images/rc/saml/sm_saml_4.png">
<img src="/docs/latest/images/rc/saml/sm_saml_4.png"/>
</a>
<ul>
<li>
<strong>
Location
</strong>
: The location of the assertion consumer service
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_5.png" sdata-lightbox="/images/rc/saml/sm_saml_5.png">
<img src="/docs/latest/images/rc/saml/sm_saml_5.png"/>
</a>
</li>
</ol>
<h2 id="step-3-finish-saml-configuration-in-ping-identity">
Step 3: Finish SAML configuration in Ping Identity
</h2>
<ol>
<li>
<p>
In Ping Identity, go to
<strong>
Administrators > Connections > Applications
</strong>
and select your application name. Select the
<strong>
Configuration
</strong>
tab and select
<strong>
Edit
</strong>
.
</p>
<p>
This is where we had entered mock data. We will now enter the correct data for this step:
</p>
<ul>
<li>
<p>
Paste
<strong>
EntityID
</strong>
information in the
<strong>
Entity ID
</strong>
field.
</p>
</li>
<li>
<p>
Paste
<strong>
Location
</strong>
link in the ACS URLS field.
</p>
</li>
<li>
<p>
For the
<strong>
Sign on URL
</strong>
field, add URL
<code>
https://cloud.redis.io/#/login/?idpId=
</code>
, where you need to add the ID from the Reply URL ID, for example,
<code>
https://cloud.redis.io/#/login/?idpId=0oa5pwatz2JfpfCb91d7
</code>
.
</p>
</li>
</ul>
<p>
Select
<strong>
Save
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_13.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_13.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_13.png"/>
</a>
</li>
<li>
<p>
Select the slider to enable the app.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_14.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_14.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_14.png"/>
</a>
</li>
</ol>
<h2 id="step-4-return-to-redis-cloud-console">
Step 4: Return to Redis Cloud console
</h2>
<ol>
<li>
<p>
Return to the Redis Cloud console and select
<strong>
Activate
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_19.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_19.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_19.png"/>
</a>
</li>
<li>
<p>
A popup appears, explaining that to test the SAML connection, you need to log in with credentials of a user defined in Ping Federate.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_9.png" sdata-lightbox="/images/rc/saml/sm_saml_9.png">
<img src="/docs/latest/images/rc/saml/sm_saml_9.png"/>
</a>
</li>
<li>
<p>
The Ping Federate login screen will appear. Enter the credentials and select
<strong>
Sign In
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_20.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_20.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_20.png"/>
</a>
</li>
<li>
<p>
If the test has succeeded, you will see the following screen. Your local account is now considered a SAML account. To log in to Redis Cloud console going forward, select the
<strong>
Sign in with SSO
</strong>
button.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_11.png" sdata-lightbox="/images/rc/saml/sm_saml_11.png">
<img src="/docs/latest/images/rc/saml/sm_saml_11.png"/>
</a>
</li>
<li>
<p>
In the screen, enter your SAML email and select
<em>
Login
</em>
.
</p>
<a href="/docs/latest/images/rc/saml/ad_saml_21.png" sdata-lightbox="/images/rc/saml/ad_saml_21.png">
<img src="/docs/latest/images/rc/saml/ad_saml_21.png"/>
</a>
<p>
You have successfully configured SAML as an identity provider.
</p>
</li>
</ol>
<h2 id="idp-initiated-sso">
IdP-initiated SSO
</h2>
<p>
<code>
https://cloud.redis.io/#/login/?idpId=
</code>
</p>
<ol>
<li>
<p>
In Ping Identity, go to
<strong>
Administrators > Connections > Applications
</strong>
and select your application name. Select the
<strong>
Configuration
</strong>
tab and select
<strong>
Edit
</strong>
.
</p>
</li>
<li>
<p>
Go to
<strong>
Target Application URL
</strong>
and enter:
<strong>
https://{enviroment}/#/login/?idpId={idpId}
</strong>
, where idpId is the ID found in the Location field, after the last '/'
</p>
</li>
<li>
<p>
Select
<strong>
Save
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_16.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_16.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_16.png"/>
</a>
</li>
<li>
<p>
Go to
<strong>
<a href="https://apps.pingone.com/%7Benvironment%7D/myapps/#">
https://apps.pingone.com/{environment}/myapps/#
</a>
</strong>
, where environment is the environment ID, found in
<strong>
Administrators -> Environment
</strong>
for your app.
</p>
<a href="/docs/latest/images/rc/saml/ping_identity_saml_17.png" sdata-lightbox="/images/rc/saml/ping_identity_saml_17.png">
<img src="/docs/latest/images/rc/saml/ping_identity_saml_17.png"/>
</a>
<p>
You are redirected to the Redis Cloud console.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/security/access-control/saml-sso/saml-integration-ping-identity/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-delete/.html | <section class="prose w-full py-12">
<h1>
redis-di delete
</h1>
<p class="text-lg -mt-5 mb-10">
Deletes RDI database permanently
</p>
<h2 id="usage">
Usage
</h2>
<pre tabindex="0"><code>Usage: redis-di delete [OPTIONS]
</code></pre>
<h2 id="options">
Options
</h2>
<ul>
<li>
<p>
<code>
log_level
</code>
:
</p>
<ul>
<li>
Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'])
</li>
<li>
Default:
<code>
info
</code>
</li>
<li>
Usage:
<code>
--log-level -l
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
cluster_host
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-host
</code>
</li>
</ul>
<p>
Host/IP of Redis Enterprise Cluster (service name in case of k8s)
</p>
</li>
<li>
<p>
<code>
cluster_api_port
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: <IntRange 1<=x<=65535>
</li>
<li>
Default:
<code>
9443
</code>
</li>
<li>
Usage:
<code>
--cluster-api-port
</code>
</li>
</ul>
<p>
API Port of Redis Enterprise Cluster
</p>
</li>
<li>
<p>
<code>
cluster_user
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-user
</code>
</li>
</ul>
<p>
Redis Enterprise Cluster username with either DB Member, Cluster Member or Cluster Admin roles
</p>
</li>
<li>
<p>
<code>
cluster_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-password
</code>
</li>
</ul>
<p>
Redis Enterprise Cluster Password
</p>
</li>
<li>
<p>
<code>
rdi_host
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-host
</code>
</li>
</ul>
<p>
Host/IP of RDI Database
</p>
</li>
<li>
<p>
<code>
rdi_port
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: <IntRange 1<=x<=65535>
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-port
</code>
</li>
</ul>
<p>
Port of RDI Database
</p>
</li>
<li>
<p>
<code>
rdi_user
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-user
</code>
</li>
</ul>
<p>
RDI Database Username
</p>
</li>
<li>
<p>
<code>
rdi_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-password
</code>
</li>
</ul>
<p>
RDI Database Password
</p>
</li>
<li>
<p>
<code>
rdi_key
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key
</code>
</li>
</ul>
<p>
Private key file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cert
</code>
</li>
</ul>
<p>
Client certificate file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cacert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cacert
</code>
</li>
</ul>
<p>
CA certificate file to verify with
</p>
</li>
<li>
<p>
<code>
rdi_key_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key-password
</code>
</li>
</ul>
<p>
Password for unlocking an encrypted private key
</p>
</li>
<li>
<p>
<code>
force
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--force -f
</code>
</li>
</ul>
<p>
Force operation. skips verification prompts
</p>
</li>
<li>
<p>
<code>
help
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--help
</code>
</li>
</ul>
<p>
Show this message and exit.
</p>
</li>
</ul>
<h2 id="cli-help">
CLI help
</h2>
<pre tabindex="0"><code>Usage: redis-di delete [OPTIONS]
Deletes RDI database permanently
Options:
-l, --log-level [DEBUG|INFO|WARN|ERROR|CRITICAL]
[default: INFO]
--cluster-host TEXT Host/IP of Redis Enterprise Cluster (service
name in case of k8s) [required]
--cluster-api-port INTEGER RANGE
API Port of Redis Enterprise Cluster
[default: 9443; 1<=x<=65535; required]
--cluster-user TEXT Redis Enterprise Cluster username with
either DB Member, Cluster Member or Cluster
Admin roles [required]
--cluster-password TEXT Redis Enterprise Cluster Password
--rdi-host TEXT Host/IP of RDI Database [required]
--rdi-port INTEGER RANGE Port of RDI Database [1<=x<=65535;
required]
--rdi-user TEXT RDI Database Username
--rdi-password TEXT RDI Database Password
--rdi-key TEXT Private key file to authenticate with
--rdi-cert TEXT Client certificate file to authenticate with
--rdi-cacert TEXT CA certificate file to verify with
--rdi-key-password TEXT Password for unlocking an encrypted private
key
-f, --force Force operation. skips verification prompts
--help Show this message and exit.
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-delete/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/collect/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Collect
</h1>
<p class="text-lg -mt-5 mb-10">
Collects all records to the origin shard.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="kd">public</span> <span class="n">GearsBuilder</span><span class="o"><</span><span class="n">T</span><span class="o">></span> <span class="nf">collect</span><span class="o">()</span>
</span></span></code></pre>
</div>
<p>
Collects all of the records to the shard where the RedisGears job started.
</p>
<h2 id="parameters">
Parameters
</h2>
<p>
None
</p>
<h2 id="returns">
Returns
</h2>
<p>
Returns a GearsBuilder object with the same template type as the input builder.
</p>
<h2 id="example">
Example
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl"><span class="n">GearsBuilder</span><span class="o">.</span><span class="na">CreateGearsBuilder</span><span class="o">(</span><span class="n">reader</span><span class="o">).</span><span class="na">collect</span><span class="o">();</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/gears-v1/jvm/classes/gearsbuilder/collect/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/json.debug.html | <section class="prose w-full py-12">
<h1 class="command-name">
JSON.DEBUG
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">JSON.DEBUG</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/json">
JSON 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
N/A
</dd>
</dl>
<p>
This is a container command for debugging related tasks.
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/json.debug/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/snapshot/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin node snapshot
</h1>
<p class="text-lg -mt-5 mb-10">
Manages snapshots of the configuration of a node's shards and endpoints.
</p>
<p>
Manages snapshots of the configuration of a node's shards and endpoints.
</p>
<p>
You can create node snapshots and use them to restore the node's shards and endpoints to a configuration from a previous point in time. If you restore a node from a snapshot (for example, after an event such as failover or maintenance), the node's shards have the same placement and roles as when the snapshot was created.
</p>
<h2 id="node-snapshot-create">
<code>
node snapshot create
</code>
</h2>
<p>
Creates a snapshot of a node's current configuration, including the placement of shards and endpoints on the node and the shards' roles.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> snapshot create <name>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Creates a snapshot of the specified node
</td>
</tr>
<tr>
<td>
name
</td>
<td>
string
</td>
<td>
Name of the created snapshot
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns
<code>
Done
</code>
if the snapshot was created successfully. Otherwise, returns an error.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">1</span> snapshot create snap1
</span></span><span class="line"><span class="cl">Creating node snapshot <span class="s1">'snap1'</span> <span class="k">for</span> node:1
</span></span><span class="line"><span class="cl">Done.
</span></span></code></pre>
</div>
<h2 id="node-snapshot-delete">
<code>
node snapshot delete
</code>
</h2>
<p>
Deletes an existing snapshot of a node.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> snapshot delete <name>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
You cannot use this command to delete a snapshot created by maintenance mode. As of Redis Enterprise Software version 7.4.2, only the latest maintenance mode snapshot is kept.
</div>
</div>
<h3 id="parameters-1">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Deletes a snapshot of the specified node
</td>
</tr>
<tr>
<td>
name
</td>
<td>
string
</td>
<td>
Deletes the specified snapshot
</td>
</tr>
</tbody>
</table>
<h3 id="returns-1">
Returns
</h3>
<p>
Returns
<code>
Done
</code>
if the snapshot was deleted successfully. Otherwise, returns an error.
</p>
<h3 id="example-1">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">1</span> snapshot delete snap1
</span></span><span class="line"><span class="cl">Deleting node snapshot <span class="s1">'snap1'</span> <span class="k">for</span> node:1
</span></span><span class="line"><span class="cl">Done.
</span></span></code></pre>
</div>
<h2 id="node-snapshot-list">
<code>
node snapshot list
</code>
</h2>
<p>
Displays a list of created snapshots for the specified node.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> snapshot list
</span></span></code></pre>
</div>
<h3 id="parameters-2">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Displays snapshots of the specified node
</td>
</tr>
</tbody>
</table>
<h3 id="returns-2">
Returns
</h3>
<p>
Returns a list of snapshots of the specified node.
</p>
<h3 id="example-2">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> snapshot list
</span></span><span class="line"><span class="cl">Name Node Time
</span></span><span class="line"><span class="cl">snap2 <span class="m">2</span> 2022-05-12T19:27:51Z
</span></span></code></pre>
</div>
<h2 id="node-snapshot-restore">
<code>
node snapshot restore
</code>
</h2>
<p>
Restores a node's shards and endpoints as close to the stored snapshot as possible.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> snapshot restore <name>
</span></span></code></pre>
</div>
<h3 id="parameters-3">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Restore the specified node from a snapshot.
</td>
</tr>
<tr>
<td>
restore
</td>
<td>
string
</td>
<td>
Name of the snapshot used to restore the node.
</td>
</tr>
</tbody>
</table>
<h3 id="returns-3">
Returns
</h3>
<p>
Returns
<code>
Snapshot restore completed successfully
</code>
if the actions needed to restore the snapshot completed successfully. Otherwise, it returns an error.
</p>
<h3 id="example-3">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> snapshot restore snap2
</span></span><span class="line"><span class="cl">Reading node snapshot <span class="s1">'snap2'</span> <span class="k">for</span> node:2
</span></span><span class="line"><span class="cl">Planning restore
</span></span><span class="line"><span class="cl">Planned actions:
</span></span><span class="line"><span class="cl">* migrate redis:15 to node:2
</span></span><span class="line"><span class="cl">* failover redis:14
</span></span><span class="line"><span class="cl">* migrate redis:17 to node:2
</span></span><span class="line"><span class="cl">* failover redis:16
</span></span><span class="line"><span class="cl">* migrate redis:19 to node:2
</span></span><span class="line"><span class="cl">* failover redis:18
</span></span><span class="line"><span class="cl">* migrate redis:21 to node:2
</span></span><span class="line"><span class="cl">* failover redis:20
</span></span><span class="line"><span class="cl">Proceed?<span class="o">[</span>Y<span class="o">]</span>es/<span class="o">[</span>N<span class="o">]</span>o? Y
</span></span><span class="line"><span class="cl">2022-05-12T19:43:31.486613 Scheduling <span class="m">8</span> actions
</span></span><span class="line"><span class="cl"><span class="o">[</span>2022-05-12T19:43:31.521422 Actions Status: <span class="m">8</span> waiting <span class="o">]</span>
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:21 to node:2<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:19 to node:2<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:17 to node:2<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:15 to node:2<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl"><span class="o">[</span>2022-05-12T19:43:32.586084 Actions Status: <span class="m">4</span> executing <span class="p">|</span> <span class="m">4</span> waiting <span class="o">]</span>
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:21 to node:2<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:19 to node:2<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:17 to node:2<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>migrate redis:15 to node:2<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:20<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:18<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:16<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:14<span class="o">]</span> <span class="nv">waiting</span> <span class="o">=</span>> executing
</span></span><span class="line"><span class="cl"><span class="o">[</span>2022-05-12T19:43:33.719496 Actions Status: <span class="m">4</span> finished <span class="p">|</span> <span class="m">4</span> executing <span class="o">]</span>
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:20<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:18<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:16<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">* <span class="o">[</span>failover redis:14<span class="o">]</span> <span class="nv">executing</span> <span class="o">=</span>> finished
</span></span><span class="line"><span class="cl">Snapshot restore completed successfully.
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/snapshot/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Install Redis on Linux
</h1>
<p class="text-lg -mt-5 mb-10">
How to install Redis on Linux
</p>
<p>
Most major Linux distributions provide packages for Redis.
</p>
<h2 id="install-on-ubuntudebian">
Install on Ubuntu/Debian
</h2>
<p>
Add the repository to the APT index, update it, and install Redis:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt-get install lsb-release curl gpg
</span></span><span class="line"><span class="cl">curl -fsSL https://packages.redis.io/gpg <span class="p">|</span> sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
</span></span><span class="line"><span class="cl">sudo chmod <span class="m">644</span> /usr/share/keyrings/redis-archive-keyring.gpg
</span></span><span class="line"><span class="cl"><span class="nb">echo</span> <span class="s2">"deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb </span><span class="k">$(</span>lsb_release -cs<span class="k">)</span><span class="s2"> main"</span> <span class="p">|</span> sudo tee /etc/apt/sources.list.d/redis.list
</span></span><span class="line"><span class="cl">sudo apt-get update
</span></span><span class="line"><span class="cl">sudo apt-get install redis</span></span></code></pre>
</div>
<p>
Redis will start automatically, and it should restart at boot time. If Redis doesn't start across reboots, you may need to manually enable it:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> redis-server
</span></span><span class="line"><span class="cl">sudo systemctl start redis-server</span></span></code></pre>
</div>
<h2 id="install-on-red-hatrocky">
Install on Red Hat/Rocky
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo yum install redis
</span></span><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> redis
</span></span><span class="line"><span class="cl">sudo systemctl start redis</span></span></code></pre>
</div>
<p>
Redis will restart at boot time.
</p>
<h2 id="install-on-ubuntu-using-snap">
Install on Ubuntu using Snap
</h2>
<p>
To install via Snap, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo apt update
</span></span><span class="line"><span class="cl">sudo apt install redis-tools <span class="c1"># for redis-cli</span>
</span></span><span class="line"><span class="cl">sudo snap install redis</span></span></code></pre>
</div>
<p>
Redis will start automatically, but it won't restart at boot time. To do this, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo snap <span class="nb">set</span> redis service.start<span class="o">=</span>true</span></span></code></pre>
</div>
<p>
You can use these additional snap-related commands to start, stop, restart, and check the status of Redis:
</p>
<ul>
<li>
<code>
sudo snap start redis
</code>
</li>
<li>
<code>
sudo snap stop redis
</code>
</li>
<li>
<code>
sudo snap restart redis
</code>
</li>
<li>
<code>
sudo snap services redis
</code>
</li>
</ul>
<p>
If your Linux distribution does not currently have Snap installed, you can install it using the instructions described
<a href="https://snapcraft.io/docs/installing-snapd">
here
</a>
. Then, consult the
<a href="https://snapcraft.io/redis">
Snapcraft store
</a>
for instructions on installing Redis using Snap for your distribution.
</p>
<h2 id="starting-and-stopping-redis-in-the-background">
Starting and stopping Redis in the background
</h2>
<p>
You can start the Redis server as a background process using the
<code>
systemctl
</code>
command. This only applies to Ubuntu/Debian when installed using
<code>
apt
</code>
, and Red Hat/Rocky when installed using
<code>
yum
</code>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl start <redis-service-name> <span class="c1"># redis or redis-server depending on platform</span></span></span></code></pre>
</div>
<p>
To stop the server, use:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">sudo systemctl stop <redis-service-name> <span class="c1"># redis or redis-server depending on platform</span></span></span></code></pre>
</div>
<h2 id="connect-to-redis">
Connect to Redis
</h2>
<p>
Once Redis is running, you can test it by running
<code>
redis-cli
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis-cli</span></span></code></pre>
</div>
<p>
Test the connection with the
<code>
ping
</code>
command:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> ping
</span></span><span class="line"><span class="cl">PONG</span></span></code></pre>
</div>
<p>
You can also test that your Redis server is running using
<a href="/docs/latest/develop/tools/insight/">
Redis Insight
</a>
.
</p>
<h2 id="next-steps">
Next steps
</h2>
<p>
Once you have a running Redis instance, you may want to:
</p>
<ul>
<li>
Try the
<a href="/docs/latest/develop/tools/cli/">
Redis CLI tutorial
</a>
</li>
<li>
Connect using one of the
<a href="/docs/latest/develop/clients/">
Redis clients
</a>
</li>
<li>
<a href="/docs/latest/operate/oss_and_stack/install/install-redis/#install-redis-properly">
Install Redis "properly"
</a>
for production use.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/install/install-redis/install-redis-on-linux/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/api/examples/view-account-information/.html | <section class="prose w-full py-12 max-w-none">
<h1>
View account information
</h1>
<p class="text-lg -mt-5 mb-10">
Get initial information on account parameters
</p>
<p>
The root API operation returns information about the current account, user, and API Key (as identified by the set of API Keys provided in the API request).
</p>
<div class="highlight">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">GET <span class="s2">"https://[host]/v1/subscriptions/<subscription_id>/databases/<database_id>/metrics?metricSpan=1hour"</span>
</span></span></code></pre>
</div>
<p>
Here is an example of the API operation response:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"account"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"id"</span><span class="p">:</span> <span class="mi">654321</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"Redis"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"createdTimestamp"</span><span class="p">:</span> <span class="s2">"2018-12-23T15:15:31Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"updatedTimestamp"</span><span class="p">:</span> <span class="s2">"2019-07-04T12:22:04Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"key"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"jay-doe-api-key-6"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"accountId"</span><span class="p">:</span> <span class="mi">654321</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"accountName"</span><span class="p">:</span> <span class="s2">"Redis account for Jay Doe"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"allowedSourceIps"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"192.0.2.0/24"</span>
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"createdTimestamp"</span><span class="p">:</span> <span class="s2">"2019-06-06T07:41:14Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"owner"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"Jay Doe"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"email"</span><span class="p">:</span> <span class="s2">"[email protected]"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"httpSourceIp"</span><span class="p">:</span> <span class="s2">"192.0.2.0"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<p>
The above example contains:
</p>
<ul>
<li>
<strong>
httpSourceIp
</strong>
: The public source IP of the current user
</li>
<li>
<strong>
allowedSourceIps
</strong>
: Restricts the current API Key access to requests originating from IP addresses that reside within the specified IP range
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/api/examples/view-account-information/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/clients/nodejs/.html | <section class="prose w-full py-12 max-w-none">
<h1>
node-redis guide (JavaScript)
</h1>
<p class="text-lg -mt-5 mb-10">
Connect your Node.js/JavaScript application to a Redis database
</p>
<p>
<a href="https://github.com/redis/node-redis">
node-redis
</a>
is the Redis client for Node.js/JavaScript.
The sections below explain how to install
<code>
node-redis
</code>
and connect your application
to a Redis database.
</p>
<p>
<code>
node-redis
</code>
requires a running Redis or
<a href="/docs/latest/operate/oss_and_stack/install/install-stack/">
Redis Stack
</a>
server. See
<a href="/docs/latest/operate/oss_and_stack/install/">
Getting started
</a>
for Redis installation instructions.
</p>
<p>
You can also access Redis with an object-mapping client interface. See
<a href="/docs/latest/integrate/redisom-for-node-js/">
RedisOM for Node.js
</a>
for more information.
</p>
<h2 id="install">
Install
</h2>
<p>
To install node-redis, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">npm install redis
</span></span></code></pre>
</div>
<h2 id="connect-and-test">
Connect and test
</h2>
<p>
Connect to localhost on port 6379.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span> <span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nx">client</span><span class="p">.</span><span class="nx">on</span><span class="p">(</span><span class="s1">'error'</span><span class="p">,</span> <span class="nx">err</span> <span class="p">=></span> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s1">'Redis Client Error'</span><span class="p">,</span> <span class="nx">err</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">();</span>
</span></span></code></pre>
</div>
<p>
Store and retrieve a simple string.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key'</span><span class="p">,</span> <span class="s1">'value'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">value</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">get</span><span class="p">(</span><span class="s1">'key'</span><span class="p">);</span>
</span></span></code></pre>
</div>
<p>
Store and retrieve a map.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hSet</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">name</span><span class="o">:</span> <span class="s1">'John'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">surname</span><span class="o">:</span> <span class="s1">'Smith'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">company</span><span class="o">:</span> <span class="s1">'Redis'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">age</span><span class="o">:</span> <span class="mi">29</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">let</span> <span class="nx">userSession</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">hGetAll</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">JSON</span><span class="p">.</span><span class="nx">stringify</span><span class="p">(</span><span class="nx">userSession</span><span class="p">,</span> <span class="kc">null</span><span class="p">,</span> <span class="mi">2</span><span class="p">));</span>
</span></span><span class="line"><span class="cl"><span class="cm">/*
</span></span></span><span class="line"><span class="cl"><span class="cm">{
</span></span></span><span class="line"><span class="cl"><span class="cm"> "surname": "Smith",
</span></span></span><span class="line"><span class="cl"><span class="cm"> "name": "John",
</span></span></span><span class="line"><span class="cl"><span class="cm"> "company": "Redis",
</span></span></span><span class="line"><span class="cl"><span class="cm"> "age": "29"
</span></span></span><span class="line"><span class="cl"><span class="cm">}
</span></span></span><span class="line"><span class="cl"><span class="cm"> */</span>
</span></span></code></pre>
</div>
<p>
To connect to a different host or port, use a connection string in the format
<code>
redis[s]://[[username][:password]@][host][:port][/db-number]
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-js" data-lang="js"><span class="line"><span class="cl"><span class="nx">createClient</span><span class="p">({</span>
</span></span><span class="line"><span class="cl"> <span class="nx">url</span><span class="o">:</span> <span class="s1">'redis://alice:[email protected]:6380'</span>
</span></span><span class="line"><span class="cl"><span class="p">});</span>
</span></span></code></pre>
</div>
<p>
To check if the client is connected and ready to send commands, use
<code>
client.isReady
</code>
, which returns a Boolean.
<code>
client.isOpen
</code>
is also available. This returns
<code>
true
</code>
when the client's underlying socket is open, and
<code>
false
</code>
when it isn't (for example, when the client is still connecting or reconnecting after a network error).
</p>
<h2 id="more-information">
More information
</h2>
<p>
The
<a href="https://redis.js.org/">
<code>
node-redis
</code>
website
</a>
has more examples.
The
<a href="https://github.com/redis/node-redis">
Github repository
</a>
also has useful
information, including a guide to the
<a href="https://github.com/redis/node-redis/blob/master/docs/client-configuration.md">
connection configuration options
</a>
you can use.
</p>
<p>
See also the other pages in this section for more information and examples:
</p>
<nav>
<a href="/docs/latest/develop/clients/nodejs/connect/">
Connect to the server
</a>
<p>
Connect your Node.js application to a Redis database
</p>
<a href="/docs/latest/develop/clients/nodejs/produsage/">
Production usage
</a>
<p>
Get your Node.js app ready for production
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/clients/nodejs/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/maintenance-mode/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin node maintenance_mode
</h1>
<p class="text-lg -mt-5 mb-10">
Turns quorum-only mode on or off for a node.
</p>
<p>
Configures
<a href="/docs/latest/operate/rs/clusters/maintenance-mode/#activate-maintenance-mode">
quorum-only mode
</a>
on a node.
</p>
<h2 id="node-maintenance_mode-on">
<code>
node maintenance_mode on
</code>
</h2>
<p>
Migrates shards out of the node and turns the node into a quorum node to prevent shards from returning to it.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> maintenance_mode on
</span></span><span class="line"><span class="cl"> <span class="o">[</span> keep_slave_shards <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> evict_ha_replica <span class="o">{</span> enabled <span class="p">|</span> disabled <span class="o">}</span> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> evict_active_active_replica <span class="o">{</span> enabled <span class="p">|</span> disabled <span class="o">}</span> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> evict_dbs <list of database names or IDs> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> demote_node <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> overwrite_snapshot <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> max_concurrent_actions <integer> <span class="o">]</span>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Turns the specified node into a quorum node
</td>
</tr>
<tr>
<td>
demote_node
</td>
<td>
</td>
<td>
If the node is a primary node, changes the node to replica
</td>
</tr>
<tr>
<td>
evict_ha_replica
</td>
<td>
<code>
enabled
</code>
<br/>
<code>
disabled
</code>
</td>
<td>
Migrates the HA replica shards in the node
</td>
</tr>
<tr>
<td>
evict_active_active_replica
</td>
<td>
<code>
enabled
</code>
<br/>
<code>
disabled
</code>
</td>
<td>
Migrates the Active-Active replica shards in the node
</td>
</tr>
<tr>
<td>
evict_dbs
</td>
<td>
list of database names or IDs
</td>
<td>
Specify databases whose shards should be evicted from the node when entering maintenance mode.
<br/>
<br/>
Examples:
<br/>
<code>
$ rladmin node 1 maintenance_mode on evict_dbs db:1 db:2
</code>
<br/>
<code>
$ rladmin node 1 maintenance_mode on evict_dbs db_name1 db_name2
</code>
</td>
</tr>
<tr>
<td>
keep_slave_shards
</td>
<td>
</td>
<td>
Keeps replica shards in the node and demotes primary shards to replicas.
<br/>
<br/>
Deprecated as of Redis Enterprise Software 7.4.2. Use
<code>
evict_ha_replica disabled evict_active_active_replica disabled
</code>
instead.
</td>
</tr>
<tr>
<td>
max_concurrent_actions
</td>
<td>
integer
</td>
<td>
Maximum number of concurrent actions during node maintenance
</td>
</tr>
<tr>
<td>
overwrite_snapshot
</td>
<td>
</td>
<td>
Overwrites the latest existing node snapshot taken when enabling maintenance mode
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns
<code>
OK
</code>
if the node was converted successfully. If the cluster does not have enough resources to migrate the shards, the process returns a warning.
</p>
<p>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-nodes">
<code>
rladmin status nodes
</code>
</a>
to verify the node became a quorum node.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> maintenance_mode on overwrite_snapshot
</span></span><span class="line"><span class="cl">Found snapshot from 2024-01-06T11:36:47Z, overwriting the snapshot
</span></span><span class="line"><span class="cl">Performing maintenance_on action on node:2: 0%
</span></span><span class="line"><span class="cl">created snapshot NodeSnapshot<<span class="nv">name</span><span class="o">=</span>maintenance_mode_2024-01-11_20-25-37,time<span class="o">=</span>None,node_uid<span class="o">=</span>2>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">node:2 will not accept any more shards
</span></span><span class="line"><span class="cl">Performing maintenance_on action on node:2: 100%
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">$ rladmin status nodes
</span></span><span class="line"><span class="cl">CLUSTER NODES:
</span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION STATUS
</span></span><span class="line"><span class="cl">*node:1 master 192.0.2.12 198.51.100.1 3d99db1fdf4b 5/100 <span class="m">6</span> 14.21GB/19.54GB 10.62GB/16.02GB 6.2.12-37 OK
</span></span><span class="line"><span class="cl">node:2 slave 192.0.2.13 198.51.100.2 fc7a3d332458 0/0 <span class="m">6</span> 14.21GB/19.54GB 0KB/0KB 6.2.12-37 OK
</span></span><span class="line"><span class="cl">node:4 slave 192.0.2.14 6d754fe12cb9 5/100 <span class="m">6</span> 14.21GB/19.54GB 10.62GB/16.02GB 6.2.12-37 OK
</span></span></code></pre>
</div>
<h2 id="node-maintenance_mode-off">
<code>
node maintenance_mode off
</code>
</h2>
<p>
Turns maintenance mode off and returns the node to its previous state.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin node <ID> maintenance_mode off
</span></span><span class="line"><span class="cl"> <span class="o">[</span> <span class="o">{</span> snapshot_name <name> <span class="p">|</span> skip_shards_restore <span class="o">}</span> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> max_concurrent_actions <integer> <span class="o">]</span>
</span></span></code></pre>
</div>
<h3 id="parameters-1">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
node
</td>
<td>
integer
</td>
<td>
Restores the node back to the previous state
</td>
</tr>
<tr>
<td>
max_concurrent_actions
</td>
<td>
integer
</td>
<td>
Maximum number of concurrent actions during node maintenance
</td>
</tr>
<tr>
<td>
skip_shards_restore
</td>
<td>
</td>
<td>
Does not restore shards back to the node
</td>
</tr>
<tr>
<td>
snapshot_name
</td>
<td>
string
</td>
<td>
Restores the node back to a state stored in the specified snapshot
</td>
</tr>
</tbody>
</table>
<h3 id="returns-1">
Returns
</h3>
<p>
Returns
<code>
OK
</code>
if the node was restored successfully.
</p>
<p>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-nodes">
<code>
rladmin status nodes
</code>
</a>
to verify the node was restored.
</p>
<h3 id="example-1">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin node <span class="m">2</span> maintenance_mode off
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">Found snapshot: NodeSnapshot<<span class="nv">name</span><span class="o">=</span>maintenance_mode_2022-05-12_20-25-37,time<span class="o">=</span>2022-05-12T20:25:37Z,node_uid<span class="o">=</span>2>
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">migrate redis:12 to node:2: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">migrate redis:12 to node:2: finished
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">migrate redis:17 to node:2: executing
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">migrate redis:15 to node:2: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">migrate redis:17 to node:2: finished
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">migrate redis:15 to node:2: finished
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">failover redis:16: executing
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">failover redis:14: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">failover redis:16: finished
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">failover redis:14: finished
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">failover redis:18: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">failover redis:18: finished
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">migrate redis:21 to node:2: executing
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">migrate redis:19 to node:2: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">migrate redis:21 to node:2: finished
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">migrate redis:19 to node:2: finished
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">failover redis:20: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">failover redis:20: finished
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">rebind endpoint:6:1: executing
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 0%
</span></span><span class="line"><span class="cl">rebind endpoint:6:1: finished
</span></span><span class="line"><span class="cl">Performing maintenance_off action on node:2: 100%
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">$ rladmin status nodes
</span></span><span class="line"><span class="cl">CLUSTER NODES:
</span></span><span class="line"><span class="cl">NODE:ID ROLE ADDRESS EXTERNAL_ADDRESS HOSTNAME SHARDS CORES FREE_RAM PROVISIONAL_RAM VERSION STATUS
</span></span><span class="line"><span class="cl">*node:1 master 192.0.2.12 198.51.100.1 3d99db1fdf4b 5/100 <span class="m">6</span> 14.2GB/19.54GB 10.61GB/16.02GB 6.2.12-37 OK
</span></span><span class="line"><span class="cl">node:2 slave 192.0.2.13 198.51.100.2 fc7a3d332458 5/100 <span class="m">6</span> 14.2GB/19.54GB 10.61GB/16.02GB 6.2.12-37 OK
</span></span><span class="line"><span class="cl">node:4 slave 192.0.2.14 6d754fe12cb9 0/100 <span class="m">6</span> 14.2GB/19.54GB 10.69GB/16.02GB 6.2.12-37 OK
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/node/maintenance-mode/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/write-behind/reference/data-transformation-block-types/rename_field/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rename_field
</h1>
<p class="text-lg -mt-5 mb-10">
Rename fields. All other fields remain unchanged.
</p>
<p>
Rename fields. All other fields remain unchanged.
</p>
<p>
<strong>
Option 1 (alternative):
</strong>
Rename multiple fields
</p>
<p>
<strong>
Properties
</strong>
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type
</th>
<th>
Description
</th>
<th>
Required
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#option1fields">
<strong>
fields
</strong>
</a>
</td>
<td>
<code>
object[]
</code>
</td>
<td>
Fields
<br/>
</td>
<td>
yes
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Additional Properties:
</strong>
not allowed
<br/>
<strong>
Example
</strong>
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">redislabs</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">dbo</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">emp</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">rename_field</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">fields</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">from_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.lname</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">to_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.last_name</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">from_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.fname</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">to_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.first_name</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
<strong>
Option 2 (alternative):
</strong>
Rename one field
</p>
<p>
<strong>
Properties
</strong>
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type
</th>
<th>
Description
</th>
<th>
Required
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
from_field
</strong>
</td>
<td>
<code>
string
</code>
</td>
<td>
From field
<br/>
</td>
<td>
yes
</td>
</tr>
<tr>
<td>
<strong>
to_field
</strong>
</td>
<td>
<code>
string
</code>
</td>
<td>
To field
<br/>
</td>
<td>
yes
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Additional Properties:
</strong>
not allowed
</p>
<p>
<strong>
Example
</strong>
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">source</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">server_name</span><span class="p">:</span><span class="w"> </span><span class="l">redislabs</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">schema</span><span class="p">:</span><span class="w"> </span><span class="l">dbo</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">table</span><span class="p">:</span><span class="w"> </span><span class="l">emp</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">transform</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">uses</span><span class="p">:</span><span class="w"> </span><span class="l">rename_field</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">with</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">from_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.lname</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">to_field</span><span class="p">:</span><span class="w"> </span><span class="l">name.last_name</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
<a name="option1fields">
</a>
</p>
<h2 id="option-1-fields-array">
Option 1: fields[]: array
</h2>
<p>
Fields
</p>
<p>
<strong>
Items
</strong>
</p>
<p>
<strong>
Item Properties
</strong>
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type
</th>
<th>
Description
</th>
<th>
Required
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
from_field
</strong>
</td>
<td>
<code>
string
</code>
</td>
<td>
From field
<br/>
</td>
<td>
yes
</td>
</tr>
<tr>
<td>
<strong>
to_field
</strong>
</td>
<td>
<code>
string
</code>
</td>
<td>
To field
<br/>
</td>
<td>
yes
</td>
</tr>
</tbody>
</table>
<p>
<strong>
Item Additional Properties:
</strong>
not allowed
</p>
<p>
<strong>
Example
</strong>
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl">- {}<span class="w">
</span></span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/reference/data-transformation-block-types/rename_field/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/unlink/.html | <section class="prose w-full py-12">
<h1 class="command-name">
UNLINK
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">UNLINK key [key ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
4.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1) for each key removed regardless of its size. Then the command does O(N) work in a different thread in order to reclaim memory, where N is the number of allocations the deleted objects where composed of.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@keyspace
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
This command is very similar to
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
: it removes the specified keys.
Just like
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
a key is ignored if it does not exist. However the command
performs the actual memory reclaiming in a different thread, so it is not
blocking, while
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
is. This is where the command name comes from: the
command just
<strong>
unlinks
</strong>
the keys from the keyspace. The actual removal
will happen later asynchronously.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SET key1 "Hello"
"OK"
redis> SET key2 "World"
"OK"
redis> UNLINK key1 key2 key3
(integer) 2
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the number of keys that were unlinked.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/unlink/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/compatibility/commands/generic/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Key commands compatibility
</h1>
<p class="text-lg -mt-5 mb-10">
Generic key commands compatible with Redis Enterprise.
</p>
<p>
The following table shows which Redis Community Edition
<a href="/docs/latest/commands/?group=generic">
key (generic) commands
</a>
are compatible with standard and Active-Active databases in Redis Enterprise Software and Redis Cloud.
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Command
</th>
<th style="text-align:left">
Redis
<br/>
Enterprise
</th>
<th style="text-align:left">
Redis
<br/>
Cloud
</th>
<th style="text-align:left">
Notes
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/copy/">
COPY
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active*
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active*
</nobr>
</span>
</td>
<td style="text-align:left">
For Active-Active or clustered databases, the source and destination keys must be in the same hash slot.
<br/>
<br/>
*Not supported for stream consumer group info.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/del/">
DEL
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/dump/">
DUMP
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/exists/">
EXISTS
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/expire/">
EXPIRE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/expireat/">
EXPIREAT
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/expiretime/">
EXPIRETIME
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/keys/">
KEYS
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/migrate/">
MIGRATE
</a>
</td>
<td style="text-align:left">
<span title="Not supported">
❌ Standard
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Not supported">
❌ Standard
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/move/">
MOVE
</a>
</td>
<td style="text-align:left">
<span title="Not supported">
❌ Standard
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Not supported">
❌ Standard
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
Redis Enterprise does not support shared databases due to potential negative performance impacts and blocks any related commands.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/object-encoding/">
OBJECT ENCODING
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/object-freq/">
OBJECT FREQ
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/object-idletime/">
OBJECT IDLETIME
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/object-refcount/">
OBJECT REFCOUNT
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/persist/">
PERSIST
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/pexpire/">
PEXPIRE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/pexpireat/">
PEXPIREAT
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/pexpiretime/">
PEXPIRETIME
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/pttl/">
PTTL
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/randomkey/">
RANDOMKEY
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/rename/">
RENAME
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active*
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active*
</nobr>
</span>
</td>
<td style="text-align:left">
For Active-Active or clustered databases, the original key and new key must be in the same hash slot.
<br/>
<br/>
*Not supported for stream consumer group info.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/renamenx/">
RENAMENX
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
For Active-Active or clustered databases, the original key and new key must be in the same hash slot.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/restore/">
RESTORE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Not supported">
❌ Active-Active*
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Not supported">
❌ Active-Active*
</span>
</td>
<td style="text-align:left">
*Only supported for module keys.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/scan/">
SCAN
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/sort/">
SORT
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/sort_ro/">
SORT_RO
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/touch/">
TOUCH
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/ttl/">
TTL
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/type/">
TYPE
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/unlink/">
UNLINK
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/wait/">
WAIT
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active*
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Not supported">
❌ Standard**
</span>
<br/>
<span title="Not supported">
<nobr>
❌ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
*For Active-Active databases,
<code>
WAIT
</code>
commands are supported for primary and replica shard replication. You can contact support to enable
<code>
WAIT
</code>
for local replicas only.
<code>
WAIT
</code>
is not supported for cross-instance replication.
<br/>
<br/>
**
<code>
WAIT
</code>
commands are supported on Redis Cloud Flexible subscriptions.
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/commands/waitaof/">
WAITAOF
</a>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
<span title="Supported">
✅ Standard
</span>
<br/>
<span title="Supported">
<nobr>
✅ Active-Active
</nobr>
</span>
</td>
<td style="text-align:left">
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/compatibility/commands/generic/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/basic-constructs/configuration-parameters.html | <section class="prose w-full py-12">
<h1>
Configuration parameters
</h1>
<p class="text-lg -mt-5 mb-10">
Querying and searching in Redis Stack can be tuned through multiple configuration parameters. Some of these parameters can only be set at load-time, while other parameters can be set either at load-time or at run-time.
</p>
<h2 id="set-configuration-parameters-at-module-load-time">
Set configuration parameters at module load-time
</h2>
<p>
Setting configuration parameters at load-time is done by appending arguments after the
<code>
--loadmodule
</code>
argument when starting a server from the command line, or after the
<code>
loadmodule
</code>
directive in a Redis config file. For example:
</p>
<p>
In
<a href="/docs/latest/operate/oss_and_stack/management/config/">
redis.conf
</a>
:
</p>
<pre tabindex="0"><code>loadmodule ./redisearch.so [OPT VAL]...
</code></pre>
<p>
From the
<a href="/docs/latest/develop/tools/cli/">
Redis CLI
</a>
, using the
<a href="/docs/latest/commands/module-load/">
MODULE LOAD
</a>
command:
</p>
<pre tabindex="0"><code>127.0.0.6379> MODULE LOAD redisearch.so [OPT VAL]...
</code></pre>
<p>
From the command line:
</p>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so [OPT VAL]...
</code></pre>
<h2 id="set-configuration-parameters-at-run-time-for-supported-parameters">
Set configuration parameters at run-time (for supported parameters)
</h2>
<p>
RediSearch exposes the
<code>
FT.CONFIG
</code>
endpoint to allow for the setting and retrieval of configuration parameters at run-time.
</p>
<p>
To set the value of a configuration parameter at run-time (for supported parameters), simply run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.CONFIG SET OPT1 VAL1
</span></span></code></pre>
</div>
<p>
Similarly, you can retrieve current configuration parameter values using:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">FT.CONFIG GET OPT1
</span></span><span class="line"><span class="cl">FT.CONFIG GET *
</span></span></code></pre>
</div>
<p>
Values set using
<a href="/docs/latest/commands/ft.config-set/">
<code>
FT.CONFIG SET
</code>
</a>
are not persisted after server restart.
</p>
<h2 id="redisearch-configuration-parameters">
RediSearch configuration parameters
</h2>
<p>
The following table summarizes which configuration parameters can be set at module load-time and run-time:
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Configuration Parameter
</th>
<th style="text-align:left">
Load-time
</th>
<th style="text-align:left">
Run-time
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="#timeout">
TIMEOUT
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#on_timeout">
ON_TIMEOUT
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#safemode">
SAFEMODE
</a>
deprecated in v1.6
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#concurrent_write_mode">
CONCURRENT_WRITE_MODE
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#extload">
EXTLOAD
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#minprefix">
MINPREFIX
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#minstemlen">
MINSTEMLEN
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#maxprefixexpansions">
MAXPREFIXEXPANSIONS
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#maxdoctablesize">
MAXDOCTABLESIZE
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#maxsearchresults">
MAXSEARCHRESULTS
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#maxaggregateresults">
MAXAGGREGATERESULTS
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#frisoini">
FRISOINI
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#cursor_max_idle">
CURSOR_MAX_IDLE
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#partial_indexed_docs">
PARTIAL_INDEXED_DOCS
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#gc_scansize">
GC_SCANSIZE
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
⬜
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#gc_policy">
GC_POLICY
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#nogc">
NOGC
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#fork_gc_run_interval">
FORK_GC_RUN_INTERVAL
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#fork_gc_retry_interval">
FORK_GC_RETRY_INTERVAL
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#fork_gc_clean_threshold">
FORK_GC_CLEAN_THRESHOLD
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#upgrade_index">
UPGRADE_INDEX
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#oss_global_password">
OSS_GLOBAL_PASSWORD
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
⬜
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#default_dialect">
DEFAULT_DIALECT
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#vss_max_resize">
VSS_MAX_RESIZE
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="#index_cursor_limit">
INDEX_CURSOR_LIMIT
</a>
</td>
<td style="text-align:left">
✅
</td>
<td style="text-align:left">
✅
</td>
</tr>
</tbody>
</table>
<hr/>
<h3 id="timeout">
TIMEOUT
</h3>
<p>
The maximum amount of time in milliseconds that a search query is allowed to run. If this time is exceeded, Redis returns the top results accumulated so far, or an error depending on the policy set with
<code>
ON_TIMEOUT
</code>
. The timeout can be disabled by setting it to 0.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
<code>
TIMEOUT
</code>
refers to query time only.
</li>
<li>
Parsing the query is not counted towards
<code>
TIMEOUT
</code>
.
</li>
<li>
If
<code>
TIMEOUT
</code>
was not reached during the search, finalizing operations such as loading document content or reducers continue.
</li>
</ul>
</div>
</div>
<h4 id="default">
Default
</h4>
<p>
500
</p>
<h4 id="example">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so TIMEOUT 100
</code></pre>
<hr/>
<h3 id="on_timeout">
ON_TIMEOUT
</h3>
<p>
The response policy for queries that exceed the
<code>
TIMEOUT
</code>
setting can be one of the following:
</p>
<ul>
<li>
<strong>
RETURN
</strong>
: this policy will return the top results accumulated by the query until it timed out.
</li>
<li>
<strong>
FAIL
</strong>
: will return an error when the query exceeds the timeout value.
</li>
</ul>
<h4 id="default-1">
Default
</h4>
<p>
RETURN
</p>
<h4 id="example-1">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so ON_TIMEOUT fail
</code></pre>
<hr/>
<h3 id="safemode">
SAFEMODE
</h3>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Deprecated:
</div>
Deprecated in v1.6. From this version, SAFEMODE is the default. If you would still like to re-enable the concurrent mode for writes, use
<a href="#concurrent_write_mode">
CONCURRENT_WRITE_MODE
</a>
.
</div>
</div>
<p>
If present in the argument list, RediSearch will turn off concurrency for query processing and work in a single thread.
</p>
<p>
This is useful if data consistency is extremely important, and avoids a situation where deletion of documents while querying them can cause momentarily inconsistent results. For example, documents that were valid during the invocation of the query are not returned because they were deleted during query processing.
</p>
<h4 id="default-2">
Default
</h4>
<p>
Off (not present)
</p>
<h4 id="example-2">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so SAFEMODE
</code></pre>
<hr/>
<h3 id="concurrent_write_mode">
CONCURRENT_WRITE_MODE
</h3>
<p>
If enabled, write queries will be performed concurrently, but only the tokenization part is executed concurrently. The actual write operation still requires holding the Redis Global Lock.
</p>
<h4 id="default-3">
Default
</h4>
<p>
Not set - "disabled"
</p>
<h4 id="example-3">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so CONCURRENT_WRITE_MODE
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Added in v1.6
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="extload">
EXTLOAD
</h3>
<p>
If present, RediSearch will try to load an extension dynamic library from its specified file path. See
<a href="/docs/latest/develop/interact/search-and-query/administration/extensions/">
Extensions
</a>
for details.
</p>
<h4 id="default-4">
Default
</h4>
<p>
None
</p>
<h4 id="example-4">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so EXTLOAD ./ext/my_extension.so
</code></pre>
<hr/>
<h3 id="minprefix">
MINPREFIX
</h3>
<p>
The minimum number of characters allowed for prefix queries (e.g.,
<code>
hel*
</code>
). Setting it to 1 can hurt performance.
</p>
<h4 id="default-5">
Default
</h4>
<p>
2
</p>
<h4 id="example-5">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MINPREFIX 3
</code></pre>
<hr/>
<h3 id="minstemlen">
MINSTEMLEN
</h3>
<p>
The minimum word length to stem. The default value is
<code>
4
</code>
. Setting it lower than
<code>
4
</code>
can reduce performance.
</p>
<h4 id="default-6">
Default
</h4>
<p>
4
</p>
<h4 id="example-6">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MINSTEMLEN 3
</code></pre>
<hr/>
<h3 id="maxprefixexpansions">
MAXPREFIXEXPANSIONS
</h3>
<p>
The maximum number of expansions allowed for query prefixes. Setting it too high can cause performance issues. If MAXPREFIXEXPANSIONS is reached, the query will continue with the first acquired results. The configuration is applicable for all affix queries including prefix, suffix, and infix (contains) queries.
</p>
<h4 id="default-7">
Default
</h4>
<p>
200
</p>
<h4 id="example-7">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MAXPREFIXEXPANSIONS 1000
</code></pre>
<hr/>
<h3 id="maxdoctablesize">
MAXDOCTABLESIZE
</h3>
<p>
The maximum size of the internal hash table used for storing the documents.
Note: this configuration option doesn't limit the number of documents that can be stored. It only affects the hash table internal array maximum size.
Decreasing this property can decrease the memory overhead in cases where the index holds a small number of documents that are constantly updated.
</p>
<h4 id="default-8">
Default
</h4>
<p>
1000000
</p>
<h4 id="example-8">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MAXDOCTABLESIZE 3000000
</code></pre>
<hr/>
<h3 id="maxsearchresults">
MAXSEARCHRESULTS
</h3>
<p>
The maximum number of results to be returned by the
<a href="/docs/latest/commands/ft.search/">
<code>
FT.SEARCH
</code>
</a>
command if LIMIT is used.
Setting value to
<code>
-1
</code>
will remove the limit.
</p>
<h4 id="default-9">
Default
</h4>
<p>
1000000
</p>
<h4 id="example-9">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MAXSEARCHRESULTS 3000000
</code></pre>
<hr/>
<h3 id="maxaggregateresults">
MAXAGGREGATERESULTS
</h3>
<p>
The maximum number of results to be returned by the
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
command if LIMIT is used.
Setting value to
<code>
-1
</code>
will remove the limit.
</p>
<h4 id="default-10">
Default
</h4>
<p>
unlimited
</p>
<h4 id="example-10">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so MAXAGGREGATERESULTS 3000000
</code></pre>
<hr/>
<h3 id="frisoini">
FRISOINI
</h3>
<p>
If present, load the custom Chinese dictionary from the specified path. See
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/chinese#using-custom-dictionaries">
Using custom dictionaries
</a>
for more details.
</p>
<h4 id="default-11">
Default
</h4>
<p>
Not set
</p>
<h4 id="example-11">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so FRISOINI /opt/dict/friso.ini
</code></pre>
<hr/>
<h3 id="cursor_max_idle">
CURSOR_MAX_IDLE
</h3>
<p>
The maximum idle time (in ms) that can be set to the
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/aggregations#cursor-api">
cursor api
</a>
.
</p>
<h4 id="default-12">
Default
</h4>
<p>
300000
</p>
<h4 id="example-12">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so CURSOR_MAX_IDLE 500000
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Added in v1.6
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="partial_indexed_docs">
PARTIAL_INDEXED_DOCS
</h3>
<p>
Enable/disable the Redis command filter. The filter optimizes partial updates of hashes
and may avoid re-indexing the hash if changed fields are not part of the schema.
</p>
<h4 id="considerations">
Considerations
</h4>
<p>
The Redis command filter will be executed upon each Redis command. Though the filter is
optimized, this will introduce a small increase in latency on all commands.
<br/>
This configuration is best used with partially indexed documents where the non-indexed fields are updated frequently.
</p>
<h4 id="default-13">
Default
</h4>
<p>
0
</p>
<h4 id="example-13">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so PARTIAL_INDEXED_DOCS 1
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Added in v2.0.0
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="gc_scansize">
GC_SCANSIZE
</h3>
<p>
The bulk size of the internal GC used for cleaning up indexes.
</p>
<h4 id="default-14">
Default
</h4>
<p>
100
</p>
<h4 id="example-14">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so GC_SCANSIZE 10
</code></pre>
<hr/>
<h3 id="gc_policy">
GC_POLICY
</h3>
<p>
The garbage collection policy. Supported policies are:
</p>
<ul>
<li>
<strong>
FORK
</strong>
: uses a forked thread for garbage collection (v1.4.1 and above).
This is the default GC policy since version 1.6.1 and is ideal
for general purpose workloads.
</li>
<li>
<strong>
LEGACY
</strong>
: Uses a synchronous, in-process fork. This is ideal for read-heavy
and append-heavy workloads with very few updates/deletes.
Deprecated in v2.6.0.
</li>
</ul>
<h4 id="default-15">
Default
</h4>
<p>
FORK
</p>
<h4 id="example-15">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so GC_POLICY FORK
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
When the
<code>
GC_POLICY
</code>
is
<code>
FORK
</code>
it can be combined with the options below.
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="nogc">
NOGC
</h3>
<p>
If set, Garbage Collection is disabled for all indexes. This is used mainly for debugging and testing and should not be set by users.
</p>
<h4 id="default-16">
Default
</h4>
<p>
Not set
</p>
<h4 id="example-16">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so NOGC
</code></pre>
<hr/>
<h3 id="fork_gc_run_interval">
FORK_GC_RUN_INTERVAL
</h3>
<p>
Interval (in seconds) between two consecutive
<code>
fork GC
</code>
runs.
</p>
<h4 id="default-17">
Default
</h4>
<p>
30
</p>
<h4 id="example-17">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so GC_POLICY FORK FORK_GC_RUN_INTERVAL 60
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Can only be combined with
<code>
GC_POLICY FORK
</code>
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="fork_gc_retry_interval">
FORK_GC_RETRY_INTERVAL
</h3>
<p>
Interval (in seconds) in which RediSearch will retry to run
<code>
fork GC
</code>
in case of a failure. Usually, a failure could happen when the Redis fork API does not allow for more than one fork to be created at the same time.
</p>
<h4 id="default-18">
Default
</h4>
<p>
5
</p>
<h4 id="example-18">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so GC_POLICY FORK FORK_GC_RETRY_INTERVAL 10
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
Can only be combined with
<code>
GC_POLICY FORK
</code>
</li>
<li>
Added in v1.4.16
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="fork_gc_clean_threshold">
FORK_GC_CLEAN_THRESHOLD
</h3>
<p>
The
<code>
fork GC
</code>
will only start to clean when the number of not cleaned documents exceeds this threshold, otherwise it will skip this run. While the default value is 100, it's highly recommended to change it to a higher number.
</p>
<h4 id="default-19">
Default
</h4>
<p>
100
</p>
<h4 id="example-19">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so GC_POLICY FORK FORK_GC_CLEAN_THRESHOLD 10000
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
Can only be combined with
<code>
GC_POLICY FORK
</code>
</li>
<li>
Added in v1.4.16
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="upgrade_index">
UPGRADE_INDEX
</h3>
<p>
This configuration is a special configuration option introduced to upgrade indices from v1.x RediSearch versions, otherwise known as legacy indices. This configuration option needs to be given for each legacy index, followed by the index name and all valid options for the index description (also referred to as the
<code>
ON
</code>
arguments for following hashes) as described on
<a href="/docs/latest/commands/ft.create/">
ft.create api
</a>
.
</p>
<h4 id="default-20">
Default
</h4>
<p>
There is no default for index name, and the other arguments have the same defaults as with the
<a href="/docs/latest/commands/ft.create/">
<code>
FT.CREATE
</code>
</a>
API.
</p>
<h4 id="example-20">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so UPGRADE_INDEX idx PREFIX 1 tt LANGUAGE french LANGUAGE_FIELD MyLang SCORE 0.5 SCORE_FIELD MyScore PAYLOAD_FIELD MyPayload UPGRADE_INDEX idx1
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
If the RDB file does not contain a legacy index that's specified in the configuration, a warning message will be added to the log file, and loading will continue.
</li>
<li>
If the RDB file contains a legacy index that wasn't specified in the configuration, loading will fail and the server won't start.
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="oss_global_password">
OSS_GLOBAL_PASSWORD
</h3>
<p>
Global Redis Community Edition cluster password that will be used to connect to other shards.
</p>
<h4 id="default-21">
Default
</h4>
<p>
Not set
</p>
<h4 id="example-21">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so OSS_GLOBAL_PASSWORD password
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
Only relevant when Coordinator is used
</li>
<li>
Added in v2.0.3
</li>
</ul>
</div>
</div>
<hr/>
<h3 id="default_dialect">
DEFAULT_DIALECT
</h3>
<p>
The default
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/">
DIALECT
</a>
to be used by
<a href="/docs/latest/commands/ft.create/">
<code>
FT.CREATE
</code>
</a>
,
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
,
<a href="/docs/latest/commands/ft.explain/">
<code>
FT.EXPLAIN
</code>
</a>
,
<a href="/docs/latest/commands/ft.explaincli/">
<code>
FT.EXPLAINCLI
</code>
</a>
, and
<a href="/docs/latest/commands/ft.spellcheck/">
<code>
FT.SPELLCHECK
</code>
</a>
.
See
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/">
Query dialects
</a>
for more information.
</p>
<h4 id="default-22">
Default
</h4>
<p>
1
</p>
<h4 id="example-22">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so DEFAULT_DIALECT 2
</code></pre>
<hr/>
<h3 id="vss_max_resize">
VSS_MAX_RESIZE
</h3>
<p>
The maximum memory resize for vector similarity indexes in bytes. This value will override default memory limits if you need to allow for a large
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/vectors/#creation-attributes-per-algorithm">
<code>
BLOCK_SIZE
</code>
</a>
.
</p>
<h4 id="default-23">
Default
</h4>
<p>
0
</p>
<h4 id="example-23">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so VSS_MAX_RESIZE 52428800 # 50MB
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
Added in v2.4.8
</li>
</ul>
</div>
</div>
<h3 id="index_cursor_limit">
INDEX_CURSOR_LIMIT
</h3>
<p>
The maximum number of cursors that can be opened, per shard, at any given time. Cursors can be opened by the user via
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE WITHCURSOR
</code>
</a>
. Cursors are also opened internally by the Redis Query Engine for long-running queries. Once
<code>
INDEX_CURSOR_LIMIT
</code>
is reached, any further attempts at opening a cursor will result in an error.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Notes:
</div>
<ul>
<li>
<p>
Caution should be used in modifying this parameter. Every open cursor results in additional memory usage.
</p>
</li>
<li>
<p>
Cursor usage should be regulated first by use of
<a href="/docs/latest/commands/ft.cursor-del/">
<code>
FT.CURSOR DEL
</code>
</a>
and/or
<a href="/docs/latest/commands/ft.aggregate/">
<code>
MAXIDLE
</code>
</a>
prior to modifying
<code>
INDEX_CURSOR_LIMIT
</code>
</p>
</li>
<li>
<p>
See
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/aggregations#cursor-api">
Cursor API
</a>
for more details.
</p>
</li>
<li>
<p>
Added in 2.10.8
</p>
</li>
</ul>
</div>
</div>
<h4 id="default-24">
Default
</h4>
<p>
128
</p>
<h4 id="example-24">
Example
</h4>
<pre tabindex="0"><code>$ redis-server --loadmodule ./redisearch.so INDEX_CURSOR_LIMIT 180
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/basic-constructs/configuration-parameters/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/manage-installation-questions/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage installation questions
</h1>
<p class="text-lg -mt-5 mb-10">
Describes Redis Enterprise Software installation questions and how to answer them automatically.
</p>
<p>
Several questions are displayed during the Redis Enterprise Software installation process.
</p>
<p>
Here, you'll find a list of these questions and learn how to automatically answer these questions to perform a silent install.
</p>
<h2 id="installation-questions">
Installation questions
</h2>
<p>
Several questions appear during installation:
</p>
<ul>
<li>
<p>
<strong>
Linux swap file
</strong>
-
<code>
Swap is enabled. Do you want to proceed? [Y/N]?
</code>
</p>
<p>
We recommend that you
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/configuring/linux-swap/">
disable Linux swap
</a>
in the operating system configuration
to give Redis Enterprise Software control of the memory allocation.
</p>
</li>
<li>
<p>
<strong>
Automatic OS tuning
</strong>
-
<code>
Do you want to automatically tune the system for best performance [Y/N]?
</code>
</p>
<p>
To allow the installation process to optimize the OS for Redis Enterprise Software, answer
<code>
Y
</code>
.
The installation process prompts you for additional information.
</p>
<p>
The
<code>
/opt/redislabs/sbin/systune.sh
</code>
file contains details about the tuning process.
</p>
</li>
<li>
<p>
<strong>
Network time
</strong>
-
<code>
Do you want to set up NTP time synchronization now [Y/N]?
</code>
</p>
<p>
Redis Enterprise Software requires that all cluster nodes have synchronized time.
You can either let the installation process configure NTP
or you can
<a href="/docs/latest/operate/rs/7.4/clusters/configure/sync-clocks/">
configure NTP manually
</a>
.
</p>
</li>
<li>
<p>
<strong>
Firewall ports
</strong>
-
<code>
Would you like to open RedisLabs cluster ports on the default firewall zone [Y/N]?
</code>
</p>
<p>
Redis Enterprise Software requires that all nodes have
<a href="/docs/latest/operate/rs/7.4/networking/port-configurations/">
specific network ports
</a>
open.
To open the ports, you can:
</p>
<ul>
<li>
Answer
<code>
Y
</code>
to let the installation process open these ports.
</li>
<li>
Answer
<code>
N
</code>
and configure the firewall manually for
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/configuring/centos-rhel-firewall/">
RHEL/CentOS firewall
</a>
.
</li>
<li>
Answer
<code>
N
</code>
and configure the firewall on the node manually for your OS.
</li>
</ul>
</li>
<li>
<p>
<strong>
Installation verification (rlcheck)
</strong>
-
<code>
Would you like to run rlcheck to verify proper configuration? [Y/N]?
</code>
</p>
<p>
Run the
<code>
rlcheck
</code>
installation verification to make sure that the installation completed successfully.
If you want to run this verification at a later time, you can run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">/opt/redislabs/bin/rlcheck
</span></span></code></pre>
</div>
</li>
<li>
<p>
<strong>
User already exists
</strong>
-
<code>
The user 'redislabs' already exists, which may lead to problems if it wasn't configured correctly. Would you like to proceed with the installation? (Y/N)?
</code>
</p>
</li>
<li>
<p>
<strong>
Group already exists
</strong>
-
<code>
The group 'redislabs' already exists, which may lead to problems if it wasn't configured correctly. Would you like to proceed with the installation? (Y/N)?
</code>
</p>
</li>
</ul>
<h2 id="answer-install-questions-automatically">
Answer install questions automatically
</h2>
<p>
To perform a silent (or automated) install, answer the questions when you start the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/">
install
</a>
.
</p>
<h3 id="answer-yes-to-all-questions">
Answer yes to all questions
</h3>
<p>
To automatically answer
<code>
yes
</code>
to all questions (which accepts the default values), run the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-script/">
installation script
</a>
with the
<code>
-y
</code>
parameter:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">./install.sh -y
</span></span></code></pre>
</div>
<h3 id="configure-file-to-answer">
Configure file to answer
</h3>
<p>
Use an answer file to manage your response:
</p>
<ol>
<li>
<p>
Create a text file to serve as an answer file.
</p>
<p>
The answer file can contain any of the parameters for the installation questions and indicate the answer for each question with
<code>
yes
</code>
or
<code>
no
</code>
.
</p>
<p>
For example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nv">ignore_swap</span><span class="o">=</span>no
</span></span><span class="line"><span class="cl"><span class="nv">systune</span><span class="o">=</span>yes
</span></span><span class="line"><span class="cl"><span class="nv">ntp</span><span class="o">=</span>no
</span></span><span class="line"><span class="cl"><span class="nv">firewall</span><span class="o">=</span>no
</span></span><span class="line"><span class="cl"><span class="nv">rlcheck</span><span class="o">=</span>yes
</span></span><span class="line"><span class="cl"><span class="nv">ignore_existing_osuser_osgroup</span><span class="o">=</span>no
</span></span></code></pre>
</div>
<p>
If you use
<code>
systune=yes
</code>
, the installation answers
<code>
yes
</code>
to all of the system tuning questions.
</p>
</li>
<li>
<p>
Run the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-script/">
installation script
</a>
with the
<code>
-c
</code>
command-line option and add the path to the answer file.
</p>
<p>
For example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">./install.sh -c /home/user/answers
</span></span></code></pre>
</div>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/manage-installation-questions/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/create/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Create a Redis Enterprise Software database
</h1>
<p class="text-lg -mt-5 mb-10">
Create a database with Redis Enterprise Software.
</p>
<p>
Redis Enterprise Software lets you create databases and distribute them across a cluster of nodes.
</p>
<p>
To create a new database:
</p>
<ol>
<li>
<p>
Sign in to the Cluster Manager UI at
<code>
https://<hostname>:8443
</code>
</p>
</li>
<li>
<p>
Use one of the following methods to create a new database:
</p>
<ul>
<li>
<p>
<a href="#quick-database">
Quick database
</a>
</p>
</li>
<li>
<p>
<a href="#create-database">
Create database
</a>
with additional configuration
</p>
</li>
</ul>
</li>
<li>
<p>
If you did not specify a port number for the database, you can find the port number in the
<strong>
Endpoint
</strong>
field in the
<strong>
Databases > Configuration > General
</strong>
section.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/databases/connect/test-client-connectivity/">
Test client connectivity
</a>
.
</p>
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
For databases with Active-Active replication for geo-distributed locations,
see
<a href="/docs/latest/operate/rs/databases/active-active/create/">
Create an Active-Active database
</a>
. To create and manage Active-Active databases, use the legacy UI.
</div>
</div>
<h2 id="quick-database">
Quick database
</h2>
<p>
To quickly create a database and skip additional configuration options during initial creation:
</p>
<ol>
<li>
<p>
On the
<strong>
Databases
</strong>
screen, select
<strong>
Quick database
</strong>
.
</p>
</li>
<li>
<p>
Select a Redis version from the
<strong>
Database version
</strong>
list.
</p>
</li>
<li>
<p>
Configure settings that are required for database creation but can be changed later:
</p>
<ul>
<li>
<p>
Database name
</p>
</li>
<li>
<p>
Memory limit (GB)
</p>
</li>
</ul>
</li>
<li>
<p>
Configure optional settings that can't be changed after database creation:
</p>
<ul>
<li>
<p>
Endpoint port (set by the cluster if not set manually)
</p>
</li>
<li>
<p>
Capabilities (previously modules) to enable
</p>
</li>
</ul>
</li>
<li>
<p>
Optionally select
<strong>
Full options
</strong>
to configure
<a href="/docs/latest/operate/rs/databases/configure/#config-settings">
additional settings
</a>
.
</p>
</li>
<li>
<p>
Select
<strong>
Create
</strong>
.
</p>
</li>
</ol>
<h2 id="create-database">
Create database
</h2>
<p>
To create a new database and configure additional settings:
</p>
<ol>
<li>
<p>
Open the
<strong>
Create database
</strong>
menu with one of the following methods:
</p>
<ul>
<li>
<p>
Click the
<strong>
+
</strong>
button next to
<strong>
Databases
</strong>
in the navigation menu:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/create-db-plus-drop-down.png" sdata-lightbox="/images/rs/screenshots/databases/create-db-plus-drop-down.png">
<img alt="Create database menu has two options: Single Region and Active-Active database." src="/docs/latest/images/rs/screenshots/databases/create-db-plus-drop-down.png" width="350px"/>
</a>
</li>
<li>
<p>
Go to the
<strong>
Databases
</strong>
screen and select
<strong>
Create database
</strong>
:
</p>
<a href="/docs/latest/images/rs/screenshots/databases/create-db-button-drop-down.png" sdata-lightbox="/images/rs/screenshots/databases/create-db-button-drop-down.png">
<img alt="Create database menu has two options: Single Region and Active-Active database." src="/docs/latest/images/rs/screenshots/databases/create-db-button-drop-down.png" width="350px"/>
</a>
</li>
</ul>
</li>
<li>
<p>
Select the database type:
</p>
<ul>
<li>
<p>
<strong>
Single Region
</strong>
</p>
</li>
<li>
<p>
<strong>
Active-Active database
</strong>
- Multiple participating Redis Enterprise clusters can host instances of the same
<a href="/docs/latest/operate/rs/databases/active-active/">
Active-Active database
</a>
in different geographic locations. Every instance can receive write operations, which are synchronized across all instances without conflict.
</p>
</li>
</ul>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
For Active-Active databases, see
<a href="/docs/latest/operate/rs/databases/active-active/create/">
Create an Active-Active geo-replicated database
</a>
.
</div>
</div>
</li>
<li>
<p>
Select a Redis version from the
<strong>
Database version
</strong>
list.
</p>
</li>
<li>
<p>
Enter a
<strong>
Database name
</strong>
.
</p>
<ul>
<li>
<p>
Maximum of 63 characters
</p>
</li>
<li>
<p>
Only letters, numbers, or hyphens (-) are valid characters
</p>
</li>
<li>
<p>
Must start and end with a letter or digit
</p>
</li>
<li>
<p>
Case-sensitive
</p>
</li>
</ul>
</li>
<li>
<p>
To configure additional database settings, expand each relevant section to make changes.
</p>
<p>
See
<a href="/docs/latest/operate/rs/databases/configure/#config-settings">
Configuration settings
</a>
for more information about each setting.
</p>
</li>
<li>
<p>
Select
<strong>
Create
</strong>
.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/create/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/data-type-handling/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Data type handling
</h1>
<p class="text-lg -mt-5 mb-10">
Learn how relational data types are converted to Redis data types
</p>
<p>
RDI automatically converts data that has a Debezium JSON schema into Redis types.
Some Debezium types require special conversion. For example:
</p>
<ul>
<li>
Date and Time types are converted to epoch time.
</li>
<li>
Decimal numeric types are converted to strings so your app can use them
without losing precision.
</li>
</ul>
<p>
The following Debezium logical types are supported:
</p>
<ul>
<li>
double
</li>
<li>
float
</li>
<li>
io.debezium.data.Bits
</li>
<li>
io.debezium.data.Json
</li>
<li>
io.debezium.data.VariableScaleDecimal
</li>
<li>
io.debezium.time.Date
</li>
<li>
io.debezium.time.NanoTime
</li>
<li>
io.debezium.time.NanoTimestamp
</li>
<li>
io.debezium.time.MicroTime
</li>
<li>
io.debezium.time.MicroTimestamp
</li>
<li>
io.debezium.time.ZonedTime
</li>
<li>
io.debezium.time.ZonedTimestamp
</li>
<li>
org.apache.kafka.connect.data.Date
</li>
<li>
org.apache.kafka.connect.data.Decimal
</li>
<li>
org.apache.kafka.connect.data.Time
</li>
</ul>
<p>
These types are
<strong>
not
</strong>
supported and will return "Unsupported Error":
</p>
<ul>
<li>
io.debezium.time.interval
</li>
</ul>
<p>
All other values are treated as plain strings.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-data-integration/data-pipelines/data-type-handling/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/pfmerge/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PFMERGE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PFMERGE destkey [sourcekey [sourcekey ...]]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.8.9
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) to merge N HyperLogLogs, but with high constant times.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@hyperloglog
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Merge multiple HyperLogLog values into a unique value that will approximate
the cardinality of the union of the observed Sets of the source HyperLogLog
structures.
</p>
<p>
The computed merged HyperLogLog is set to the destination variable, which is
created if does not exist (defaulting to an empty HyperLogLog).
</p>
<p>
If the destination variable exists, it is treated as one of the source sets
and its cardinality will be included in the cardinality of the computed
HyperLogLog.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> PFADD hll1 foo bar zap a
(integer) 1
redis> PFADD hll2 a b c foo
(integer) 1
redis> PFMERGE hll3 hll1 hll2
"OK"
redis> PFCOUNT hll3
(integer) 6
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#simple-strings">
Simple string reply
</a>
:
<code>
OK
</code>
.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/pfmerge/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ft.config-set.html | <section class="prose w-full py-12">
<h1 class="command-name">
FT.CONFIG SET
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FT.CONFIG SET option value
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/interact/search-and-query">
Search 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Set the value of a RediSearch configuration parameter.
</p>
<p>
Values set using
<code>
FT.CONFIG SET
</code>
are not persisted after server restart.
</p>
<p>
RediSearch configuration parameters are detailed in
<a href="/docs/latest/develop/interact/search-and-query/basic-constructs/configuration-parameters/">
Configuration parameters
</a>
.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
As detailed in the link above, not all RediSearch configuration parameters can be set at runtime.
</div>
</div>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
option
</code>
</summary>
<p>
is name of the configuration option, or '*' for all.
</p>
</details>
<details open="">
<summary>
<code>
value
</code>
</summary>
<p>
is value of the configuration option.
</p>
</details>
<h2 id="return">
Return
</h2>
<p>
FT.CONFIG SET returns a simple string reply
<code>
OK
</code>
if executed correctly, or an error reply otherwise.
</p>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Set runtime configuration options
</b>
</summary>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> FT.CONFIG SET TIMEOUT <span class="m">42</span>
</span></span><span class="line"><span class="cl">OK</span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ft.config-get/">
<code>
FT.CONFIG GET
</code>
</a>
|
<a href="/docs/latest/commands/ft.config-help/">
<code>
FT.CONFIG HELP
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/interact/search-and-query/">
RediSearch
</a>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ft.config-set/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-complexity-rules/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Enable password complexity rules
</h1>
<p class="text-lg -mt-5 mb-10">
Enable password complexity rules.
</p>
<p>
Redis Enterprise Software provides optional password complexity rules that meet common requirements. When enabled, these rules require the password to have:
</p>
<ul>
<li>
At least 8 characters
</li>
<li>
At least one uppercase character
</li>
<li>
At least one lowercase character
</li>
<li>
At least one number
</li>
<li>
At least one special character
</li>
</ul>
<p>
These requirements reflect v6.2.12 and later. Earlier versions did not support numbers or special characters as the first or the last character of a password. This restriction was removed in v6.2.12.
</p>
<p>
In addition, the password:
</p>
<ul>
<li>
Cannot contain the user's email address or the reverse of the email address.
</li>
<li>
Cannot have more than three repeating characters.
</li>
</ul>
<p>
Password complexity rules apply when a new user account is created and when the password is changed. Password complexity rules are not applied to accounts authenticated by an external identity provider.
</p>
<p>
You can use the Cluster Manager UI or the REST API to enable password complexity rules.
</p>
<h2 id="enable-using-the-cluster-manager-ui">
Enable using the Cluster Manager UI
</h2>
<p>
To enable password complexity rules using the Cluster Manager UI:
</p>
<ol>
<li>
<p>
Go to
<strong>
Cluster > Security > Preferences
</strong>
, then select
<strong>
Edit
</strong>
.
</p>
</li>
<li>
<p>
In the
<strong>
Password
</strong>
section, turn on
<strong>
Complexity rules
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
Save
</strong>
.
</p>
</li>
</ol>
<h2 id="enable-using-the-rest-api">
Enable using the REST API
</h2>
<p>
To use the REST API to enable password complexity rules:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-REST" data-lang="REST"><span class="line"><span class="cl">PUT https://[host][:port]/v1/cluster<span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err"></span>{"password_complexity":true}<span class="err">
</span></span></span></code></pre>
</div>
<h2 id="deactivate-password-complexity-rules">
Deactivate password complexity rules
</h2>
<p>
To deactivate password complexity rules:
</p>
<ul>
<li>
<p>
Use the Cluster Manager UI:
</p>
<ol>
<li>
<p>
Go to
<strong>
Cluster > Security > Preferences
</strong>
, then select
<strong>
Edit
</strong>
.
</p>
</li>
<li>
<p>
In the
<strong>
Password
</strong>
section, turn off
<strong>
Complexity rules
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
Save
</strong>
.
</p>
</li>
</ol>
</li>
<li>
<p>
Use the
<code>
cluster
</code>
REST API endpoint to set
<code>
password_complexity
</code>
to
<code>
false
</code>
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-complexity-rules/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/module/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Module object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that represents a Redis module
</p>
<p>
Represents a
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/">
Redis module
</a>
.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
string
</td>
<td>
Cluster unique ID of module
</td>
</tr>
<tr>
<td>
architecture
</td>
<td>
string
</td>
<td>
Architecture used to compile the module
</td>
</tr>
<tr>
<td>
author
</td>
<td>
string
</td>
<td>
Module creator
</td>
</tr>
<tr>
<td>
capabilities
</td>
<td>
array of strings
</td>
<td>
List of capabilities supported by this module
</td>
</tr>
<tr>
<td>
capability_name
</td>
<td>
string
</td>
<td>
Short description of module functionality
</td>
</tr>
<tr>
<td>
command_line_args
</td>
<td>
string
</td>
<td>
Command line arguments passed to the module
</td>
</tr>
<tr>
<td>
compatible_redis_version
</td>
<td>
string
</td>
<td>
Redis version required by this module
</td>
</tr>
<tr>
<td>
config_command
</td>
<td>
string
</td>
<td>
Name of command to configure module arguments at runtime
</td>
</tr>
<tr>
<td>
dependencies
</td>
<td>
object dependencies
</td>
<td>
Module dependencies
</td>
</tr>
<tr>
<td>
description
</td>
<td>
string
</td>
<td>
Short description of the module
</td>
</tr>
<tr>
<td>
display_name
</td>
<td>
string
</td>
<td>
Name of module for display purposes
</td>
</tr>
<tr>
<td>
email
</td>
<td>
string
</td>
<td>
Author's email address
</td>
</tr>
<tr>
<td>
homepage
</td>
<td>
string
</td>
<td>
Module's homepage
</td>
</tr>
<tr>
<td>
is_bundled
</td>
<td>
boolean
</td>
<td>
Whether module came bundled with a version of Redis Enterprise
</td>
</tr>
<tr>
<td>
license
</td>
<td>
string
</td>
<td>
Module is distributed under this license
</td>
</tr>
<tr>
<td>
min_redis_pack_version
</td>
<td>
string
</td>
<td>
Minimum Redis Enterprise Software cluster version required by this module
</td>
</tr>
<tr>
<td>
min_redis_version
</td>
<td>
string
</td>
<td>
Minimum Redis database version required by this module. Only relevant for Redis databases earlier than v7.4.
</td>
</tr>
<tr>
<td>
module_file
</td>
<td>
string
</td>
<td>
Module filename
</td>
</tr>
<tr>
<td>
module_name
</td>
<td>
<code>
search
</code>
<br/>
<code>
ReJSON
</code>
<br/>
<code>
graph
</code>
<br/>
<code>
timeseries
</code>
<br/>
<code>
bf
</code>
</td>
<td>
Module's name
<br/>
</td>
</tr>
<tr>
<td>
os
</td>
<td>
string
</td>
<td>
Operating system used to compile the module
</td>
</tr>
<tr>
<td>
os_list
</td>
<td>
array of strings
</td>
<td>
List of supported operating systems
</td>
</tr>
<tr>
<td>
semantic_version
</td>
<td>
string
</td>
<td>
Module's semantic version
</td>
</tr>
<tr>
<td>
sha256
</td>
<td>
string
</td>
<td>
SHA256 of module binary
</td>
</tr>
<tr>
<td>
version
</td>
<td>
integer
</td>
<td>
Module's version
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/module/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/ocsp/status/.html | <section class="prose w-full py-12 max-w-none">
<h1>
OCSP status requests
</h1>
<p class="text-lg -mt-5 mb-10">
OCSP status requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-status">
GET
</a>
</td>
<td>
<code>
/v1/ocsp/status
</code>
</td>
<td>
Get OCSP status
</td>
</tr>
</tbody>
</table>
<h2 id="get-status">
Get OCSP status
</h2>
<pre><code>GET /v1/ocsp/status
</code></pre>
<p>
Gets the latest cached status of the proxy certificate’s OCSP response.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_ocsp_status">
view_ocsp_status
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /ocsp/status
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns an
<a href="/docs/latest/operate/rs/references/rest-api/objects/ocsp_status/">
OCSP status object
</a>
.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"responder_url"</span><span class="p">:</span> <span class="s2">"http://responder.ocsp.url.com"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cert_status"</span><span class="p">:</span> <span class="s2">"REVOKED"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"produced_at"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:11 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"this_update"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:11 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"next_update"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 14:50:00 GMT"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"revocation_time"</span><span class="p">:</span> <span class="s2">"Wed, 22 Dec 2021 12:50:04 GMT"</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-error-codes">
Error codes
</h3>
<p>
When errors occur, the server returns a JSON object with
<code>
error_code
</code>
and
<code>
message
</code>
fields that provide additional information. The following are possible
<code>
error_code
</code>
values:
</p>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
ocsp_unsupported_by_capability
</td>
<td>
Not all nodes support OCSP capability
</td>
</tr>
<tr>
<td>
invalid_ocsp_response
</td>
<td>
The server returned a response that is not OCSP-compatible
</td>
</tr>
</tbody>
</table>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
Feature not supported in all nodes
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/ocsp/status/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/cluster/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Cluster object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that represents a cluster
</p>
<p>
An API object that represents the cluster.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
alert_settings
</td>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/alert_settings/">
alert_settings
</a>
object
</td>
<td>
Cluster and node alert settings
</td>
</tr>
<tr>
<td>
bigstore_driver
</td>
<td>
'speedb'
<br/>
'rocksdb'
</td>
<td>
Storage engine for Auto Tiering
</td>
</tr>
<tr>
<td>
cluster_ssh_public_key
</td>
<td>
string
</td>
<td>
Cluster's autogenerated SSH public key
</td>
</tr>
<tr>
<td>
cm_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
UI HTTPS listening port
</td>
</tr>
<tr>
<td>
cm_session_timeout_minutes
</td>
<td>
integer (default: 15)
</td>
<td>
The timeout (in minutes) for the session to the CM
</td>
</tr>
<tr>
<td>
cnm_http_max_threads_per_worker
</td>
<td>
integer (default: 10)
</td>
<td>
Maximum number of threads per worker in the
<code>
cnm_http
</code>
service (deprecated)
</td>
</tr>
<tr>
<td>
cnm_http_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
API HTTP listening port
</td>
</tr>
<tr>
<td>
cnm_http_workers
</td>
<td>
integer (default: 1)
</td>
<td>
Number of workers in the
<code>
cnm_http
</code>
service
</td>
</tr>
<tr>
<td>
cnm_https_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
API HTTPS listening port
</td>
</tr>
<tr>
<td>
control_cipher_suites
</td>
<td>
string
</td>
<td>
Specifies the enabled ciphers for the control plane. The ciphers are specified in the format understood by the BoringSSL library.
</td>
</tr>
<tr>
<td>
control_cipher_suites_tls_1_3
</td>
<td>
string
</td>
<td>
Specifies the enabled TLS 1.3 ciphers for the control plane. The ciphers are specified in the format understood by the BoringSSL library. (read-only)
</td>
</tr>
<tr>
<td>
crdb_coordinator_port
</td>
<td>
integer, (range: 1024-65535) (default: 9081)
</td>
<td>
CRDB coordinator port
</td>
</tr>
<tr>
<td>
crdt_rest_client_retries
</td>
<td>
integer
</td>
<td>
Maximum number of retries for the REST client used by the Active-Active management API
</td>
</tr>
<tr>
<td>
crdt_rest_client_timeout
</td>
<td>
integer
</td>
<td>
Timeout for REST client used by the Active-Active management API
</td>
</tr>
<tr>
<td>
created_time
</td>
<td>
string
</td>
<td>
Cluster creation date (read-only)
</td>
</tr>
<tr>
<td>
data_cipher_list
</td>
<td>
string
</td>
<td>
Specifies the enabled ciphers for the data plane. The ciphers are specified in the format understood by the OpenSSL library.
</td>
</tr>
<tr>
<td>
data_cipher_suites_tls_1_3
</td>
<td>
string
</td>
<td>
Specifies the enabled TLS 1.3 ciphers for the data plane.
</td>
</tr>
<tr>
<td>
debuginfo_path
</td>
<td>
string
</td>
<td>
Path to a local directory used when generating support packages
</td>
</tr>
<tr>
<td>
default_non_sharded_proxy_policy
</td>
<td>
string (default: single)
</td>
<td>
Default proxy_policy for newly created non-sharded databases' endpoints (read-only)
</td>
</tr>
<tr>
<td>
default_sharded_proxy_policy
</td>
<td>
string (default: all-master-shards)
</td>
<td>
Default proxy_policy for newly created sharded databases' endpoints (read-only)
</td>
</tr>
<tr>
<td>
email_alerts
</td>
<td>
boolean (default: false)
</td>
<td>
Send node/cluster email alerts (requires valid SMTP and email_from settings)
</td>
</tr>
<tr>
<td>
email_from
</td>
<td>
string
</td>
<td>
Sender email for automated emails
</td>
</tr>
<tr>
<td>
encrypt_pkeys
</td>
<td>
boolean (default: false)
</td>
<td>
Enable or turn off encryption of private keys
</td>
</tr>
<tr>
<td>
envoy_admin_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
Envoy admin port. Changing this port during runtime might result in an empty response because envoy serves as the cluster gateway.
</td>
</tr>
<tr>
<td>
envoy_max_downstream_connections
</td>
<td>
integer, (range: 100-2048)
</td>
<td>
The max downstream connections envoy is allowed to open
</td>
</tr>
<tr>
<td>
envoy_mgmt_server_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
Envoy management server port
</td>
</tr>
<tr>
<td>
gossip_envoy_admin_port
</td>
<td>
integer, (range: 1024-65535)
</td>
<td>
Gossip envoy admin port
</td>
</tr>
<tr>
<td>
handle_redirects
</td>
<td>
boolean (default: false)
</td>
<td>
Handle API HTTPS requests and redirect to the master node internally
</td>
</tr>
<tr>
<td>
http_support
</td>
<td>
boolean (default: false)
</td>
<td>
Enable or turn off HTTP support
</td>
</tr>
<tr>
<td>
min_control_TLS_version
</td>
<td>
'1.2'
<br/>
'1.3'
</td>
<td>
The minimum version of TLS protocol which is supported at the control path
</td>
</tr>
<tr>
<td>
min_data_TLS_version
</td>
<td>
'1.2'
<br/>
'1.3'
</td>
<td>
The minimum version of TLS protocol which is supported at the data path
</td>
</tr>
<tr>
<td>
min_sentinel_TLS_version
</td>
<td>
'1.2'
<br/>
'1.3'
</td>
<td>
The minimum version of TLS protocol which is supported at the data path
</td>
</tr>
<tr>
<td>
name
</td>
<td>
string
</td>
<td>
Cluster's fully qualified domain name (read-only)
</td>
</tr>
<tr>
<td>
password_complexity
</td>
<td>
boolean (default: false)
</td>
<td>
Enforce password complexity policy
</td>
</tr>
<tr>
<td>
password_expiration_duration
</td>
<td>
integer (default: 0)
</td>
<td>
The number of days a password is valid until the user is required to replace it
</td>
</tr>
<tr>
<td>
password_min_length
</td>
<td>
integer, (range: 8-256) (default: 8)
</td>
<td>
The minimum length required for a password.
</td>
</tr>
<tr>
<td>
proxy_certificate
</td>
<td>
string
</td>
<td>
Cluster's proxy certificate
</td>
</tr>
<tr>
<td>
proxy_max_ccs_disconnection_time
</td>
<td>
integer
</td>
<td>
Cluster-wide proxy timeout policy between proxy and CCS
</td>
</tr>
<tr>
<td>
rack_aware
</td>
<td>
boolean
</td>
<td>
Cluster operates in a rack-aware mode (read-only)
</td>
</tr>
<tr>
<td>
reserved_ports
</td>
<td>
array of strings
</td>
<td>
List of reserved ports and/or port ranges to avoid using for database endpoints (for example
<code>
"reserved_ports": ["11000", "13000-13010"]
</code>
)
</td>
</tr>
<tr>
<td>
s3_url
</td>
<td>
string
</td>
<td>
Specifies the URL for S3 export and import
</td>
</tr>
<tr>
<td>
saslauthd_ldap_conf
</td>
<td>
string
</td>
<td>
saslauthd LDAP configuration
</td>
</tr>
<tr>
<td>
sentinel_cipher_suites
</td>
<td>
array
</td>
<td>
Specifies the list of enabled ciphers for the sentinel service. The supported ciphers are those implemented by the
<a href="https://golang.org/src/crypto/tls/cipher_suites.go">
cipher_suites.go
</a>
package.
</td>
</tr>
<tr>
<td>
sentinel_cipher_suites_tls_1_3
</td>
<td>
string
</td>
<td>
Specifies the list of enabled TLS 1.3 ciphers for the discovery (sentinel) service. The supported ciphers are those implemented by the
<a href="https://golang.org/src/crypto/tls/cipher_suites.go">
cipher_suites.go
</a>
package.(read-only)
</td>
</tr>
<tr>
<td>
sentinel_tls_mode
</td>
<td>
'allowed'
<br/>
'disabled'
<br/>
'required'
</td>
<td>
Determines whether the discovery service allows, blocks, or requires TLS connections (previously named
<code>
sentinel_ssl_policy
</code>
)
<br/>
<strong>
allowed
</strong>
: Allows both TLS and non-TLS connections
<br/>
<strong>
disabled
</strong>
: Allows only non-TLS connections
<br/>
<strong>
required
</strong>
: Allows only TLS connections
</td>
</tr>
<tr>
<td>
slave_ha
</td>
<td>
boolean (default: false)
</td>
<td>
Enable the replica high-availability mechanism (read-only)
</td>
</tr>
<tr>
<td>
slave_ha_bdb_cooldown_period
</td>
<td>
integer (default: 86400)
</td>
<td>
Time in seconds between runs of the replica high-availability mechanism on different nodes on the same database (read-only)
</td>
</tr>
<tr>
<td>
slave_ha_cooldown_period
</td>
<td>
integer (default: 3600)
</td>
<td>
Time in seconds between runs of the replica high-availability mechanism on different nodes (read-only)
</td>
</tr>
<tr>
<td>
slave_ha_grace_period
</td>
<td>
integer (default: 900)
</td>
<td>
Time in seconds between a node failure and when the replica high-availability mechanism starts relocating shards (read-only)
</td>
</tr>
<tr>
<td>
slowlog_in_sanitized_support
</td>
<td>
boolean
</td>
<td>
Whether to include slowlogs in the sanitized support package
</td>
</tr>
<tr>
<td>
smtp_host
</td>
<td>
string
</td>
<td>
SMTP server for automated emails
</td>
</tr>
<tr>
<td>
smtp_password
</td>
<td>
string
</td>
<td>
SMTP server password
</td>
</tr>
<tr>
<td>
smtp_port
</td>
<td>
integer
</td>
<td>
SMTP server port for automated emails
</td>
</tr>
<tr>
<td>
smtp_tls_mode
</td>
<td>
'none'
<br/>
'starttls'
<br/>
'tls'
</td>
<td>
Specifies which TLS mode to use for SMTP access
</td>
</tr>
<tr>
<td>
smtp_use_tls
</td>
<td>
boolean (default: false)
</td>
<td>
Use TLS for SMTP access (deprecated as of Redis Enterprise v4.3.3, use smtp_tls_mode field instead)
</td>
</tr>
<tr>
<td>
smtp_username
</td>
<td>
string
</td>
<td>
SMTP server username (pattern does not allow special characters &,<,>,")
</td>
</tr>
<tr>
<td>
syncer_certificate
</td>
<td>
string
</td>
<td>
Cluster's syncer certificate
</td>
</tr>
<tr>
<td>
upgrade_mode
</td>
<td>
boolean (default: false)
</td>
<td>
Is cluster currently in upgrade mode
</td>
</tr>
<tr>
<td>
use_external_ipv6
</td>
<td>
boolean (default: true)
</td>
<td>
Should redislabs services listen on ipv6
</td>
</tr>
<tr>
<td>
use_ipv6
</td>
<td>
boolean (default: true)
</td>
<td>
Should redislabs services listen on ipv6 (deprecated as of Redis Enterprise v6.4.2, replaced with use_external_ipv6)
</td>
</tr>
<tr>
<td>
wait_command
</td>
<td>
boolean (default: true)
</td>
<td>
Supports Redis wait command (read-only)
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/cluster/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/clusters/configure/sync-clocks/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Synchronize cluster node clocks
</h1>
<p class="text-lg -mt-5 mb-10">
Sync node clocks to avoid problems with internal custer communication.
</p>
<p>
To avoid problems with internal cluster communications that can impact your data integrity,
make sure that the clocks on all of the cluster nodes are synchronized using Chrony and/or NTP.
</p>
<p>
When you install Redis Enterprise Software,
the install script checks if Chrony or NTP is running.
If they are not, the installation process asks for permission to configure a scheduled Cron job.
This should make sure that the node's clock is always synchronized.
If you did not confirm configuring this job during the installation process,
you must use the Network Time Protocol (NTP) regularly to make sure that all server clocks are synchronized.
</p>
<p>
To synchronize the server clock, run the command that is appropriate for your operating system.
</p>
<h2 id="set-up-ntp-synchronization">
Set up NTP synchronization
</h2>
<p>
To set up NTP synchronization, see the following sections for instructions for specific operating systems.
</p>
<h3 id="ubuntu-1804-and-ubuntu-2004">
Ubuntu 18.04 and Ubuntu 20.04
</h3>
<ol>
<li>
<p>
Install Chrony, a replacement for NTP:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo apt install chrony
</span></span></code></pre>
</div>
</li>
<li>
<p>
Edit the Chrony configuration file:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo nano /etc/chrony/chrony.conf
</span></span></code></pre>
</div>
</li>
<li>
<p>
Add
<code>
server pool.ntp.org
</code>
to the file, replace
<code>
pool.ntp.org
</code>
with your own NTP server, then save.
</p>
</li>
<li>
<p>
Restart the Chrony service:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl restart chrony
</span></span></code></pre>
</div>
</li>
<li>
<p>
Check the Chrony service status:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl status chrony
</span></span></code></pre>
</div>
</li>
</ol>
<p>
For more details, refer to the official
<a href="https://ubuntu.com/server/docs/network-ntp">
Ubuntu 20.04 documentation
</a>
.
</p>
<h3 id="rhel-7">
RHEL 7
</h3>
<ol>
<li>
<p>
Install Chrony, a replacement for NTP:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"> sudo yum install chrony
</span></span></code></pre>
</div>
</li>
<li>
<p>
Edit the Chrony configuration file:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo nano /etc/chrony.conf
</span></span></code></pre>
</div>
</li>
<li>
<p>
Add
<code>
server pool.ntp.org
</code>
to the file, replace
<code>
pool.ntp.org
</code>
with your own NTP server, then save.
</p>
</li>
<li>
<p>
Enable and start the Chrony service:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> chronyd <span class="o">&&</span> sudo systemctl start chronyd
</span></span></code></pre>
</div>
</li>
<li>
<p>
Check the Chrony service status:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl status chronyd
</span></span></code></pre>
</div>
</li>
</ol>
<p>
For more details, refer to the official
<a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite#sect-Using_chrony">
RHEL 7 documentation
</a>
.
</p>
<h3 id="rhel-8-and-rhel-9">
RHEL 8 and RHEL 9
</h3>
<ol>
<li>
<p>
Install Chrony, a replacement for NTP:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo dnf install chrony
</span></span></code></pre>
</div>
</li>
<li>
<p>
Edit the Chrony configuration file:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo nano /etc/chrony.conf
</span></span></code></pre>
</div>
</li>
<li>
<p>
Add
<code>
server pool.ntp.org
</code>
to the file, replace
<code>
pool.ntp.org
</code>
with your own NTP server, then save.
</p>
</li>
<li>
<p>
Enable and start the Chrony service:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> chronyd <span class="o">&&</span> sudo systemctl start chronyd
</span></span></code></pre>
</div>
</li>
<li>
<p>
Check the Chrony service status:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl status chronyd
</span></span></code></pre>
</div>
</li>
</ol>
<p>
For more details, refer to the official
<a href="https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_basic_system_settings/configuring-time-synchronization_configuring-basic-system-settings">
RHEL 8 and 9 documentation
</a>
.
</p>
<h3 id="amazon-linux-2">
Amazon Linux 2
</h3>
<ol>
<li>
<p>
Install Chrony, a replacement for NTP:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo yum install chrony
</span></span></code></pre>
</div>
</li>
<li>
<p>
Edit the Chrony configuration file:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"> sudo nano /etc/chrony.conf
</span></span></code></pre>
</div>
</li>
<li>
<p>
Add
<code>
server pool.ntp.org
</code>
to the file, replace
<code>
pool.ntp.org
</code>
with your own NTP server, then save.
</p>
</li>
<li>
<p>
Enable and start the Chrony service:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl <span class="nb">enable</span> chronyd <span class="o">&&</span> sudo systemctl start chronyd
</span></span></code></pre>
</div>
</li>
<li>
<p>
Check the Chrony service status:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo systemctl status chronyd
</span></span></code></pre>
</div>
</li>
</ol>
<p>
For more details, refer to the official
<a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-time.html">
Amazon Linux 2 documentation
</a>
.
</p>
<p>
If you are using Active-Active databases, you must use
<a href="/docs/latest/operate/rs/databases/active-active/#network-time-service-ntp-or-chrony">
Network Time Service (ntpd)
</a>
to synchronize OS clocks consistently across clusters to handle conflict resolution according to the OS time.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/clusters/configure/sync-clocks/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/clients/redis-py/.html | <section class="prose w-full py-12 max-w-none">
<h1>
redis-py guide (Python)
</h1>
<p class="text-lg -mt-5 mb-10">
Connect your Python application to a Redis database
</p>
<p>
<a href="https://github.com/redis/redis-py">
redis-py
</a>
is the Python client for Redis.
The sections below explain how to install
<code>
redis-py
</code>
and connect your application
to a Redis database.
</p>
<p>
<code>
redis-py
</code>
requires a running Redis or
<a href="/docs/latest/operate/oss_and_stack/install/install-stack/">
Redis Stack
</a>
server. See
<a href="/docs/latest/operate/oss_and_stack/install/">
Getting started
</a>
for Redis installation instructions.
</p>
<p>
You can also access Redis with an object-mapping client interface. See
<a href="/docs/latest/integrate/redisom-for-python/">
RedisOM for Python
</a>
for more information.
</p>
<h2 id="install">
Install
</h2>
<p>
To install
<code>
redis-py
</code>
, enter:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">pip install redis
</span></span></code></pre>
</div>
<p>
For faster performance, install Redis with
<a href="https://github.com/redis/hiredis">
<code>
hiredis
</code>
</a>
support. This provides a compiled response parser, and for most cases requires zero code changes. By default, if
<code>
hiredis
</code>
>= 1.0 is available,
<code>
redis-py
</code>
attempts to use it for response parsing.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The Python
<code>
distutils
</code>
packaging scheme is no longer part of Python 3.12 and greater. If you're having difficulties getting
<code>
redis-py
</code>
installed in a Python 3.12 environment, consider updating to a recent release of
<code>
redis-py
</code>
.
</div>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">pip install redis<span class="o">[</span>hiredis<span class="o">]</span>
</span></span></code></pre>
</div>
<h2 id="connect-and-test">
Connect and test
</h2>
<p>
Connect to localhost on port 6379, set a value in Redis, and retrieve it. All responses are returned as bytes in Python. To receive decoded strings, set
<code>
decode_responses=True
</code>
. For more connection options, see
<a href="https://redis.readthedocs.io/en/stable/examples.html">
these examples
</a>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">host</span><span class="o">=</span><span class="s1">'localhost'</span><span class="p">,</span> <span class="n">port</span><span class="o">=</span><span class="mi">6379</span><span class="p">,</span> <span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span></code></pre>
</div>
<p>
Store and retrieve a simple string.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">,</span> <span class="s1">'bar'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># True</span>
</span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># bar</span>
</span></span></code></pre>
</div>
<p>
Store and retrieve a dict.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">hset</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">,</span> <span class="n">mapping</span><span class="o">=</span><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'name'</span><span class="p">:</span> <span class="s1">'John'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"surname"</span><span class="p">:</span> <span class="s1">'Smith'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"company"</span><span class="p">:</span> <span class="s1">'Redis'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"age"</span><span class="p">:</span> <span class="mi">29</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="c1"># True</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">hgetall</span><span class="p">(</span><span class="s1">'user-session:123'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># {'surname': 'Smith', 'name': 'John', 'company': 'Redis', 'age': '29'}</span>
</span></span></code></pre>
</div>
<h2 id="more-information">
More information
</h2>
<p>
The
<a href="https://redis-py.readthedocs.io/en/stable/index.html">
<code>
redis-py
</code>
</a>
website
has a
<a href="https://redis-py.readthedocs.io/en/stable/commands.html">
command reference
</a>
and some
<a href="https://redis.readthedocs.io/en/stable/examples.html">
tutorials
</a>
for
various tasks. There are also some examples in the
<a href="https://github.com/redis/redis-py">
GitHub repository
</a>
for
<code>
redis-py
</code>
.
</p>
<p>
See also the other pages in this section for more information and examples:
</p>
<nav>
<a href="/docs/latest/develop/clients/redis-py/connect/">
Connect to the server
</a>
<p>
Connect your Python application to a Redis database
</p>
<a href="/docs/latest/develop/clients/redis-py/queryjson/">
Example - Index and query JSON documents
</a>
<p>
Learn how to use the Redis query engine with JSON
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/clients/redis-py/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redis-data-integration/observability/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Observability
</h1>
<p class="text-lg -mt-5 mb-10">
Learn how to monitor RDI
</p>
<p>
RDI reports metrics about its operation using
<a href="https://prometheus.io/docs/instrumenting/exporters/">
Prometheus exporter endpoints
</a>
.
You can connect to the endpoints with
<a href="https://prometheus.io/docs/prometheus/latest/getting_started/">
Prometheus
</a>
to query the metrics and plot simple graphs or with
<a href="https://grafana.com/">
Grafana
</a>
to produce more complex visualizations and
dashboards.
</p>
<p>
RDI exposes two endpoints, one for
<a href="#collector-metrics">
CDC collector metrics
</a>
and
another for
<a href="#stream-processor-metrics">
stream processor metrics
</a>
.
The sections below explain these sets of metrics in more detail.
See the
<a href="/docs/latest/integrate/redis-data-integration/architecture/#overview">
architecture overview
</a>
for an introduction to these concepts.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If you don't use Prometheus or Grafana, you can still see
RDI metrics with the RDI monitoring screen in Redis Insight or with the
<a href="/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-status/">
<code>
redis-di status
</code>
</a>
command from the CLI.
</div>
</div>
<h2 id="collector-metrics">
Collector metrics
</h2>
<p>
The endpoint for the collector metrics is
<code>
https://<RDI_HOST>/metrics/collector-source
</code>
</p>
<p>
These metrics are divided into three groups:
</p>
<ul>
<li>
<strong>
Pipeline state
</strong>
: metrics about the pipeline mode and connectivity
</li>
<li>
<strong>
Data flow counters
</strong>
: counters for data breakdown per source table
</li>
<li>
<strong>
Processing performance
</strong>
: processing speed of RDI micro batches
</li>
</ul>
<h2 id="stream-processor-metrics">
Stream processor metrics
</h2>
<p>
The endpoint for the stream processor metrics is
<code>
https://<RDI_HOST>/metrics/rdi
</code>
</p>
<p>
RDI reports metrics during the two main phases of the ingest pipeline, the
<em>
snapshot
</em>
phase and the
<em>
change data capture (CDC)
</em>
phase. (See the
<a href="/docs/latest/integrate/redis-data-integration/data-pipelines/data-pipelines/">
pipeline lifecycle
</a>
docs for more information). The table below shows the full set of metrics that
RDI reports.
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Metric
</th>
<th style="text-align:left">
Phase
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
CapturedTables
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
Connected
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
LastEvent
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
LastTransactionId
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
MilliSecondsBehindSource
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
MilliSecondsSinceLastEvent
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
NumberOfCommittedTransactions
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
NumberOfEventsFiltered
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
QueueRemainingCapacity
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
QueueTotalCapacity
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
RemainingTableCount
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
RowsScanned
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotAborted
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotCompleted
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotDurationInSeconds
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotPaused
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotPausedDurationInSeconds
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SnapshotRunning
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
<tr>
<td style="text-align:left">
SourceEventPosition
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
TotalNumberOfCreateEventsSeen
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
TotalNumberOfDeleteEventsSeen
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
TotalNumberOfEventsSeen
</td>
<td style="text-align:left">
Both
</td>
</tr>
<tr>
<td style="text-align:left">
TotalNumberOfUpdateEventsSeen
</td>
<td style="text-align:left">
CDC
</td>
</tr>
<tr>
<td style="text-align:left">
TotalTableCount
</td>
<td style="text-align:left">
Snapshot
</td>
</tr>
</tbody>
</table>
<h2 id="rdi-logs">
RDI logs
</h2>
<p>
RDI uses
<a href="https://www.fluentd.org/">
fluentd
</a>
and
<a href="https://linux.die.net/man/8/logrotate">
logrotate
</a>
to ship and rotate logs
for its Kubernetes (K8s) components.
So whenever a containerized component is removed by the RDI operator process or by K8s,
the logs are available for you to inspect.
By default, RDI stores logs in the host VM file system at
<code>
/opt/rdi/logs
</code>
.
The logs are recorded at the minimum
<code>
INFO
</code>
level and get rotated when they reach a size of 100MB.
RDI retains the last five log rotated files by default.
Logs are in a straightforward text format, which lets you analyze them with several different observability tools.
You can change the default log settings using the
<a href="/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-config-rdi/">
<code>
redis-di config-rdi
</code>
</a>
command.
</p>
<h2 id="dump-support-package">
Dump support package
</h2>
<p>
If you ever need to send a comprehensive set of forensics data to Redis support then you should
run the
<a href="/docs/latest/integrate/redis-data-integration/reference/cli/redis-di-dump-support-package/">
<code>
redis-di dump-support-package
</code>
</a>
command from the CLI. See
<a href="/docs/latest/integrate/redis-data-integration/troubleshooting/#dump-support-package">
Troubleshooting
</a>
for more information.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redis-data-integration/observability/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/rotate-passwords/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Rotate passwords
</h1>
<p class="text-lg -mt-5 mb-10">
Rotate user passwords.
</p>
<p>
Redis Enterprise Software lets you implement password rotation policies using the
<a href="/docs/latest/operate/rs/7.4/references/rest-api/">
REST API
</a>
.
</p>
<p>
You can add a new password for a database user without immediately invalidating the old one (which might cause authentication errors in production).
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Password rotation does not work for the default user.
<a href="/docs/latest/operate/rs/7.4/security/access-control/create-users/">
Add additional users
</a>
to enable password rotation.
</div>
</div>
<h2 id="password-rotation-policies">
Password rotation policies
</h2>
<p>
For user access to the Redis Enterprise Software Cluster Manager UI,
you can set a
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-expiration/">
password expiration policy
</a>
to prompt the user to change their password.
</p>
<p>
However, for database connections that rely on password authentication,
you need to allow for authentication with the existing password while you roll out the new password to your systems.
</p>
<p>
With the Redis Enterprise Software REST API, you can add additional passwords to a user account for authentication to the database or the Cluster Manager UI and API.
</p>
<p>
After the old password is replaced in the database connections, you can delete the old password to finish the password rotation process.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Multiple passwords are only supported using the REST API.
If you reset the password for a user in the Cluster Manager UI,
the new password replaces all other passwords for that user.
</div>
</div>
<p>
The new password cannot already exist as a password for the user and must meet the
<a href="/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/password-complexity-rules/">
password complexity
</a>
requirements, if enabled.
</p>
<h2 id="rotate-password">
Rotate password
</h2>
<p>
To rotate the password of a user account:
</p>
<ol>
<li>
<p>
Add an additional password to a user account with
<a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/users/password/#add-password">
<code>
POST /v1/users/password
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">POST https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/users/password
</span></span><span class="line"><span class="cl"> <span class="s1">'{"username":"<username>", "old_password":"<an_existing_password>", "new_password":"<a_new_password>"}'</span>
</span></span></code></pre>
</div>
<p>
After you send this request, you can authenticate with both the old and the new password.
</p>
</li>
<li>
<p>
Update the password in all database connections that connect with the user account.
</p>
</li>
<li>
<p>
Delete the original password with
<a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/users/password/#update-password">
<code>
DELETE /v1/users/password
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">DELETE https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/users/password
</span></span><span class="line"><span class="cl"> <span class="s1">'{"username":"<username>", "old_password":"<an_existing_password>"}'</span>
</span></span></code></pre>
</div>
<p>
If there is only one valid password for a user account, you cannot delete that password.
</p>
</li>
</ol>
<h2 id="replace-all-passwords">
Replace all passwords
</h2>
<p>
You can also replace all existing passwords for a user account with a single password that does not match any existing passwords.
This can be helpful if you suspect that your passwords are compromised and you want to quickly resecure the account.
</p>
<p>
To replace all existing passwords for a user account with a single new password, use
<a href="/docs/latest/operate/rs/7.4/references/rest-api/requests/users/password/#delete-password">
<code>
PUT /v1/users/password
</code>
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT https://<span class="o">[</span>host<span class="o">][</span>:port<span class="o">]</span>/v1/users/password
</span></span><span class="line"><span class="cl"> <span class="s1">'{"username":"<username>", "old_password":"<an_existing_password>", "new_password":"<a_new_password>"}'</span>
</span></span></code></pre>
</div>
<p>
All of the existing passwords are deleted and only the new password is valid.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
If you send the above request without specifying it is a
<code>
PUT
</code>
request, the new password is added to the list of existing passwords.
</div>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/security/access-control/manage-passwords/rotate-passwords/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Plan Redis Enterprise Software deployment
</h1>
<p class="text-lg -mt-5 mb-10">
Plan a deployment of Redis Enterprise Software.
</p>
<p>
Before installing Redis Enterprise Software, you need to:
</p>
<ul>
<li>
<p>
Set up your hardware. See
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements/">
Hardware requirements
</a>
and
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/persistent-ephemeral-storage/">
Persistent and ephemeral node storage
</a>
for more information.
</p>
</li>
<li>
<p>
Choose your
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/">
deployment platform
</a>
.
</p>
<p>
Redis Enterprise Software supports a variety of platforms, including:
</p>
<ul>
<li>
Multiple Linux distributions (Ubuntu, Red Hat Enterprise Linux (RHEL), IBM CentOS, Oracle Linux)
</li>
<li>
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/configuring-aws-instances/">
Amazon AWS AMI
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/installing-upgrading/quickstarts/docker-quickstart/">
Docker container
</a>
(for development and testing only)
</li>
<li>
<a href="/docs/latest/operate/kubernetes/">
Kubernetes
</a>
</li>
</ul>
<p>
For more details, see
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/supported-platforms/">
Supported platforms
</a>
.
</p>
</li>
<li>
<p>
Open appropriate
<a href="/docs/latest/operate/rs/networking/port-configurations/">
network ports
</a>
in the firewall to allow connections to the nodes.
</p>
</li>
<li>
<p>
Configure
<a href="/docs/latest/operate/rs/networking/cluster-dns/">
cluster DNS
</a>
so that cluster nodes can reach each other by DNS names.
</p>
</li>
<li>
<p>
By default, the installation process requires an internet connection to install dependencies and synchronize the operating system clock. To learn more, see
<a href="/docs/latest/operate/rs/installing-upgrading/install/offline-installation/">
Offline installation
</a>
.
</p>
</li>
</ul>
<h2 id="next-steps">
Next steps
</h2>
<p>
After you finish planning your deployment, you can:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rs/installing-upgrading/install/prepare-install/download-install-package/">
Download an installation package
</a>
.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/installing-upgrading/install/prepare-install/">
Prepare to install
</a>
Redis Enterprise Software.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/installing-upgrading/install/manage-installation-questions/">
View installation questions
</a>
and prepare answers before installation.
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/release-notes/7-4-6-releases/7-4-6-2-oct24/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Enterprise for Kubernetes 7.4.6-2 (October 2024) release notes
</h1>
<p class="text-lg -mt-5 mb-10">
This is a maintenance release with a new version of Redis Enterprise Software 7.4.6.
</p>
<h2 id="highlights">
Highlights
</h2>
<p>
This is a maintenance release to support
<a href="/docs/latest/operate/rs/release-notes/rs-7-4-2-releases/rs-7-4-6-77/">
Redis Enterprise Software version 7.4.6-77
</a>
. For version changes, supported distributions, and known limitations, see the
<a href="/docs/latest/operate/kubernetes/release-notes/7-4-6-releases/7-4-6-2/">
release notes for 7-4-6-2 (July 2024)
</a>
.
</p>
<h2 id="downloads">
Downloads
</h2>
<ul>
<li>
<strong>
Redis Enterprise
</strong>
:
<code>
redislabs/redis:7.4.6-77
</code>
</li>
<li>
<strong>
Operator
</strong>
:
<code>
redislabs/operator:7.4.6-2
</code>
</li>
<li>
<strong>
Services Rigger
</strong>
:
<code>
redislabs/k8s-controller:7.4.6-2
</code>
</li>
</ul>
<h3 id="openshift-images">
OpenShift images
</h3>
<ul>
<li>
<strong>
Redis Enterprise
</strong>
:
<code>
registry.connect.redhat.com/redislabs/redis-enterprise:7.4.6-77.rhel8-openshift
</code>
</li>
<li>
<strong>
Operator
</strong>
:
<code>
registry.connect.redhat.com/redislabs/redis-enterprise-operator:7.4.6-2
</code>
</li>
<li>
<strong>
Services Rigger
</strong>
:
<code>
registry.connect.redhat.com/redislabs/services-manager:7.4.6-2
</code>
</li>
</ul>
<h3 id="olm-bundle">
OLM bundle
</h3>
<p>
<strong>
Redis Enterprise operator bundle
</strong>
:
<code>
v7.4.6-2.3
</code>
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/release-notes/7-4-6-releases/7-4-6-2-oct24/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/api/get-started/manage-api-keys/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage API keys
</h1>
<p class="text-lg -mt-5 mb-10">
How to use the Redis Cloud console to create and manage API user keys for your account's team owners
</p>
<p>
Every REST API request must include the following API keys:
</p>
<ol>
<li>
<p>
The
<strong>
Account key
</strong>
identifies the account associated with the Redis Cloud subscription.
</p>
</li>
<li>
<p>
The
<strong>
User key
</strong>
identifies the user and (optionally) the context of a request. Generated by account owners.
</p>
</li>
</ol>
<p>
Use the
<strong>
API Keys
</strong>
tab of the
<strong>
Access Management
</strong>
screen to manage your keys:
</p>
<ol>
<li>
<p>
Sign in to your
<a href="https://cloud.redis.io">
Redis Cloud account
</a>
as an account owner.
</p>
</li>
<li>
<p>
From the menu, choose
<strong>
Access Management
</strong>
and then select the
<strong>
API Keys
</strong>
tab.
</p>
<a href="/docs/latest/images/rc/access-management-api-keys-tab.png" sdata-lightbox="/images/rc/access-management-api-keys-tab.png">
<img alt="Use the **API Keys** tab of the **Access Management** screen to manage your REST API keys." src="/docs/latest/images/rc/access-management-api-keys-tab.png" width="75%"/>
</a>
</li>
</ol>
<p>
If an
<strong>
Enable API
</strong>
button appears, select it to
<a href="/docs/latest/operate/rc/api/get-started/enable-the-api/">
enable the REST API
</a>
for your account.
</p>
<a href="/docs/latest/images/rc/button-access-management-enable-api.png" sdata-lightbox="/images/rc/button-access-management-enable-api.png">
<img alt="Use the **Enable API** button to enable the REST API for your account." src="/docs/latest/images/rc/button-access-management-enable-api.png"/>
</a>
<h2 id="api-account-key">
API account key
</h2>
<p>
The
<strong>
API account key
</strong>
is used as the value of the
<code>
x-api-key
</code>
HTTP header in order to authenticate a REST API request.
</p>
<p>
By default, the
<strong>
API account key
</strong>
is masked; that is, it is obscured for security reasons. You can use the
<strong>
Show
</strong>
button to display the key and the
<strong>
Hide
</strong>
button to mask it.
</p>
<p>
<a href="/docs/latest/images/rc/button-access-management-show-key.png" sdata-lightbox="/images/rc/button-access-management-show-key.png">
<img alt="The **Show** button displays the account key." class="inline" src="/docs/latest/images/rc/button-access-management-show-key.png"/>
</a>
<a href="/docs/latest/images/rc/button-access-management-hide-key.png#no-click" sdata-lightbox="/images/rc/button-access-management-hide-key.png#no-click">
<img alt="The **Hide** button masks the account key." class="inline" src="/docs/latest/images/rc/button-access-management-hide-key.png#no-click"/>
</a>
</p>
<p>
The
<strong>
Copy
</strong>
button copies the account key to the Clipboard.
</p>
<a href="/docs/latest/images/rc/button-access-management-api-key-copy.png" sdata-lightbox="/images/rc/button-access-management-api-key-copy.png">
<img alt="The **Copy** button copies the account key to the Clipboard." src="/docs/latest/images/rc/button-access-management-api-key-copy.png"/>
</a>
<h2 id="api-user-keys">
API user keys
</h2>
<p>
<strong>
API user keys
</strong>
(also known as
<em>
secret keys
</em>
) are used as the value of the
<code>
x-api-secret-key
</code>
HTTP header used to authenticate a REST API request.
</p>
<p>
In this context,
<em>
user
</em>
refers to the account used to sign in to the Redis Cloud console. Users must have an owner (read-write) or viewer (read-only) role.
</p>
<p>
Users can have more than one user key; however, users should not share user keys.
</p>
<h3 id="secret">
Create a new user key
</h3>
<p>
Use the
<strong>
Add
</strong>
button to create a new user key.
</p>
<a href="/docs/latest/images/rc/button-access-management-add.png" sdata-lightbox="/images/rc/button-access-management-add.png">
<img alt="Use the **Add** button to begin creating a new user key." src="/docs/latest/images/rc/button-access-management-add.png"/>
</a>
<p>
When you do this, you're prompted for the
<strong>
Key name
</strong>
and the associated
<strong>
User name
</strong>
.
</p>
<a href="/docs/latest/images/rc/access-management-user-key-add.png" sdata-lightbox="/images/rc/access-management-user-key-add.png">
<img alt="When you add a user key, you're prompted to specify the name of the key and the asscoiated user." src="/docs/latest/images/rc/access-management-user-key-add.png"/>
</a>
<p>
The key name:
</p>
<ul>
<li>
Must be between 10 and 50 characters long
</li>
<li>
Can contain alphanumeric characters, hyphens, and underscores. Spaces are not allowed.
</li>
</ul>
<p>
The user name must have an owner or viewer role.
</p>
<p>
Select
<strong>
Create
</strong>
to create the new key.
</p>
<a href="/docs/latest/images/rc/button-access-management-user-key-create.png" sdata-lightbox="/images/rc/button-access-management-user-key-create.png">
<img alt="Use the **Create** button to create the new user key." src="/docs/latest/images/rc/button-access-management-user-key-create.png"/>
</a>
<p>
When you do this, the
<strong>
API user key
</strong>
dialog appears.
</p>
<p>
<a href="/docs/latest/images/rc/access-management-create-user-key.png" sdata-lightbox="/images/rc/access-management-create-user-key.png">
<img alt="The **API user key** dialog lets you copy the value of the new key to the Clipboard." src="/docs/latest/images/rc/access-management-create-user-key.png" width="75%"/>
</a>
<br/>
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
This is the only time the value of the user key is available. Save it to a secure location before closing the dialog box.
<br/>
<br/>
If you lose the user key value, it cannot be retrieved. If this happens, create a new key to replace the lost one.
</div>
</div>
<p>
When you've saved the user key, use the
<strong>
Finish
</strong>
button to close the dialog box.
</p>
<p>
(The
<strong>
Finish
</strong>
button is disabled until you copy the key to the Clipboard.)
</p>
<h3 id="delete-a-user-key">
Delete a user key
</h3>
<p>
To delete a user key:
</p>
<ol>
<li>
<p>
Use the
<strong>
API Keys
</strong>
tab of the
<strong>
Access Management
</strong>
screen to locate the target key
</p>
<p>
<a href="/docs/latest/images/rc/access-management-api-user-key-delete.png" sdata-lightbox="/images/rc/access-management-api-user-key-delete.png">
<img alt="The **Delete** button appears to the right of the selected user key." src="/docs/latest/images/rc/access-management-api-user-key-delete.png"/>
</a>
<br/>
</p>
</li>
<li>
<p>
Select the
<strong>
Delete
</strong>
button displayed to the right.
</p>
<a href="/docs/latest/images/rc/button-access-management-api-user-key-delete.png" sdata-lightbox="/images/rc/button-access-management-api-user-key-delete.png">
<img alt="Select the **Delete** button to begin deleting the selected user key." src="/docs/latest/images/rc/button-access-management-api-user-key-delete.png"/>
</a>
</li>
<li>
<p>
This displays the
<strong>
Delete API secret key
</strong>
dialog box.
</p>
<p>
<a href="/docs/latest/images/rc/access-management-delete-api-secret-key.png" sdata-lightbox="/images/rc/access-management-delete-api-secret-key.png">
<img alt="The **Delete** button appears to the right of the selected user key." src="/docs/latest/images/rc/access-management-delete-api-secret-key.png" width="50%"/>
</a>
<br/>
</p>
<p>
Select the
<strong>
Delete
</strong>
button to confirm.
</p>
</li>
</ol>
<h3 id="manage-cidr-allow-list">
Manage CIDR allow list
</h3>
<p>
By default, REST API requests are allowed from all IP addresses. To limit access to specific addresses, define a CIDR allow list for the user key.
</p>
<p>
To manage the CIDR allow list:
</p>
<ol>
<li>
<p>
Use the
<strong>
API Keys
</strong>
tab of the
<strong>
Access Management
</strong>
screen to locate the target key
</p>
<a href="/docs/latest/images/rc/access-management-api-user-key-delete.png" sdata-lightbox="/images/rc/access-management-api-user-key-delete.png">
<img alt="The **Manage** link appears to the right of the user name for the selected user key." src="/docs/latest/images/rc/access-management-api-user-key-delete.png"/>
</a>
</li>
<li>
<p>
Select the
<strong>
Manage
</strong>
link in the
<strong>
CIDR allow list
</strong>
column; this displays the
<strong>
Manage CIDR allow list
</strong>
dialog box.
</p>
<a href="/docs/latest/images/rc/access-management-user-key-manage-cidr.png" sdata-lightbox="/images/rc/access-management-user-key-manage-cidr.png">
<img alt="Select the **Manage** link to define the **CIDR allow list** dialog." src="/docs/latest/images/rc/access-management-user-key-manage-cidr.png" width="50%"/>
</a>
</li>
<li>
<p>
Enter each allowed IP address in
<a href="https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing#CIDR_notation">
CIDR format
</a>
(example:
<code>
127.1.0.0/24
</code>
) and then select the
<strong>
Save
</strong>
button.
</p>
<a href="/docs/latest/images/rc/button-access-management-cidr-rule-save.png" sdata-lightbox="/images/rc/button-access-management-cidr-rule-save.png">
<img alt="Use the **Save** button to save a CIDR allow list rule." src="/docs/latest/images/rc/button-access-management-cidr-rule-save.png"/>
</a>
<p>
Use the
<strong>
Add CIDR rule
</strong>
button to add additional addresses to the list.
</p>
<a href="/docs/latest/images/rc/button-access-management-cidr-rule-add.png" sdata-lightbox="/images/rc/button-access-management-cidr-rule-add.png">
<img alt="Use the **Add Rule** button to add a new address to the CIDR allow list." src="/docs/latest/images/rc/button-access-management-cidr-rule-add.png"/>
</a>
<p>
Use the
<strong>
Edit
</strong>
button to change the address for a rule or the
<strong>
Delete button
</strong>
to remove a rule.
</p>
<p>
<a href="/docs/latest/images/rc/button-access-management-cidr-rule-edit.png#no-click" sdata-lightbox="/images/rc/button-access-management-cidr-rule-edit.png#no-click">
<img alt="Use the **Edit** button to change the address for a CIDR allow list rule." class="inline" src="/docs/latest/images/rc/button-access-management-cidr-rule-edit.png#no-click"/>
</a>
<a href="/docs/latest/images/rc/button-access-management-cidr-rule-delete.png#no-click" sdata-lightbox="/images/rc/button-access-management-cidr-rule-delete.png#no-click">
<img alt="Use the **Delete** button to remove an address from the CIDR allow list." class="inline" src="/docs/latest/images/rc/button-access-management-cidr-rule-delete.png#no-click"/>
</a>
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/api/get-started/manage-api-keys/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-1.4-release-notes/.html | <section class="prose w-full py-12 max-w-none">
<h1>
RediSearch 1.4 release notes
</h1>
<p class="text-lg -mt-5 mb-10">
Conditional updates. Schema modification. Query spelling correction. Phonetic matching. More fuzziness in search. Retrieve and change runtime configuration. Unlimited autocomplete results.
</p>
<h2 id="requirements">
Requirements
</h2>
<p>
RediSearch v1.4.28 requires:
</p>
<ul>
<li>
Minimum Redis compatibility version (database): 4.0.0
</li>
<li>
Minimum Redis Enterprise Software version (cluster): 5.0.0
</li>
</ul>
<h2 id="v1428-may-2020">
v1.4.28 (May 2020)
</h2>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Bugfixes:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/pull/1218">
1218
</a>
Potential crash when running without concurrency and using the cursor API.
</li>
</ul>
</li>
</ul>
<h2 id="v1427-april-2020">
v1.4.27 (April 2020)
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Features:
<ul>
<li>
#
<a href="https://github.com/redisearch/redisearch/issues/1172">
1172
</a>
Added
<code>
exists
</code>
function that can be used on conditional updates
<code>
REPLACE PARTIAL
</code>
to check if a field exists in the document.
</li>
</ul>
</li>
<li>
Minor Enhancements:
<ul>
<li>
#
<a href="https://github.com/redisearch/redisearch/issues/1172">
1172
</a>
Lazy evaluation of the right side of 'or'/'and' clauses in IF condition.
</li>
</ul>
</li>
<li>
Bugfixes:
<ul>
<li>
#
<a href="https://github.com/redisearch/redisearch/issues/1110">
1110
</a>
Rare GC failure when accessing uninitialized variable.
</li>
<li>
#
<a href="https://github.com/redisearch/redisearch/issues/1131">
1131
</a>
Crash on highlighting a search query where the document no longer exists.
</li>
</ul>
</li>
</ul>
<h2 id="v1426-march-2020">
v1.4.26 (March 2020)
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Fix rare
<code>
FORK GC
</code>
crash which caused by accessing uninitialized variable.
</li>
</ul>
<h2 id="v1425-march-2020">
v1.4.25 (March 2020)
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Features:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1051">
1051
</a>
Added support for updating tag fields on document updates with
<code>
NOINDEX
</code>
fields.
</li>
</ul>
</li>
<li>
Bugfixes:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1051">
1051
</a>
<code>
FORK GC
</code>
was not updating the unique sum of the numeric index.
</li>
</ul>
</li>
</ul>
<h2 id="v1424-january-2020">
v1.4.24 (January 2020)
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Bugfixes:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1038">
1038
</a>
Memory leak on cursor.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1049">
1049
</a>
Crash on conversion error when freeing other indexed fields.
</li>
</ul>
</li>
</ul>
<h2 id="v1423">
v1.4.23
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Bugfixes:
<ul>
<li>
Memory leak when cursor timed out and cursor wasn't consumed.
</li>
</ul>
</li>
</ul>
<h2 id="v1422">
v1.4.22
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Bugfixes:
<ul>
<li>
FILTER option was not working correctly with coordinator.
</li>
<li>
Memory leak when cursor was combined with sorted fields.
</li>
</ul>
</li>
</ul>
<h2 id="v1421">
v1.4.21
</h2>
<p>
Headlines:
</p>
<ul>
<li>
This release improves overall stability and provides fixes for issues found after the previous release.
</li>
</ul>
<p>
Details:
</p>
<ul>
<li>
Bugfixes:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1031">
1031
</a>
Highlighting crashed when used with
<code>
NOINDEX
</code>
fields.
</li>
</ul>
</li>
</ul>
<h2 id="v1420-january-2020">
v1.4.20 (January 2020)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<ul>
<li>
Improvements
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1020">
1020
</a>
Performance improvement for reading fields that are not sortable.
</li>
</ul>
</li>
<li>
Bugfixes
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1022">
1022
</a>
Illegal memory access by queries during
<code>
GC
</code>
run.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1022">
1022
</a>
Recreating the index with the same name (delete+create) removed the index from cursor list.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1022">
1022
</a>
Memory leak when performing
<code>
FT.AGGREGATE
</code>
on non-existing index.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1022">
1022
</a>
Potential data corruption during
<code>
GC
</code>
run.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1025">
1025
</a>
Aliasing not working properly with
<code>
FT.AGGREGATE
</code>
.
</li>
</ul>
</li>
</ul>
<h2 id="v1419-december-2019">
v1.4.19 (December 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<ul>
<li>
Bugfixes
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1000">
1000
</a>
-
<code>
FT.DEL
</code>
was not replicated to replica correctly
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1004">
1004
</a>
- Memory leak on
<code>
TAG
</code>
array on certain situations
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/1006">
1006
</a>
- Unexposed error on conditional update
<code>
IF
</code>
that caused the error message to leak
</li>
</ul>
</li>
</ul>
<h2 id="v1418-november-2019">
v1.4.18 (November 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<ul>
<li>
Bug fixes
<ul>
<li>
<a href="https://github.com/RediSearch/RediSearch/issues/947">
#947
</a>
Fix short read on FORK GC pipe that could result in a crash and potential data corruption
</li>
</ul>
</li>
</ul>
<h2 id="v1417-october-2019">
v1.4.17 (October 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<ul>
<li>
Features:
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/779">
779
</a>
Added
<code>
to_number()
</code>
and
<code>
to_str()
</code>
functions for ambiguity reasons
</li>
</ul>
</li>
<li>
Improvements
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/891">
891
</a>
All memory allocations will now use the redis memory allocator. This means that all the memory will be exposed correctly in the redis
<code>
INFO MEMORY
</code>
command.
</li>
</ul>
</li>
</ul>
<h2 id="v1416-september-2019">
v1.4.16 (September 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<p>
Main features:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/883">
883
</a>
Forkgc optimizations - introduce new config parameter
<code>
FORK_GC_CLEAN_THRESHOLD
</code>
. RediSearch will only start to clean when the number of not cleaned documents is exceeding this threshold.
</li>
</ul>
<p>
Main Fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/848">
848
</a>
RediSearch will not crash when sorting on fields that don't exists in all documents.
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/884">
884
</a>
Fix wrong results on intersect iterator.
</li>
</ul>
<h2 id="v1415-28-august-2019">
v1.4.15 (28 August 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/866">
866
</a>
- Fix RDB corruption caused by deleting none-existing terms from the suggestion trie.
</li>
<li>
When Redis exits, forked processes by FORK Garbage Collection will now be closed accordingly.
</li>
<li>
For indices that are not temporary and interleaved: When an index is dropped, the indexer thread is now closed.
</li>
</ul>
<h2 id="v1414-20-august-2019">
v1.4.14 (20 August 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release.
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/851">
851
</a>
In interleaved mode (non safemode), documents deleted by concurrent updates, will be ignored.
</li>
</ul>
<h2 id="v1413-8-august-2019">
v1.4.13 (8 August 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/798">
798
</a>
fix issue where phonetic queries return wrong results
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/820">
820
</a>
fix crash on getting a none existing doc from a doc table
</li>
<li>
Fix issue with invalid memory read when using tags with ' ' (space) separator
</li>
</ul>
<h2 id="v1412-5-august-2019">
v1.4.12 (5 August 2019)
</h2>
<p>
Update urgency: Medium
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main features:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/741">
741
</a>
Allow Chinese tokenizing to recognise -escape for punctuations
</li>
</ul>
<p>
Main Fixes:
</p>
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/739">
739
</a>
Fix crash on search error
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/346">
346
</a>
Fix issue where fuzzy can not be used with numbers
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/769">
769
</a>
Fix rare crash on rdb loading
</li>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/749">
749
</a>
On prefix searches, do not expand prefixes to terms which have no documents
</li>
</ul>
<h2 id="v1411-june-2019">
v1.4.11 (June 2019)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This release only add support for aliasing to the previews 1.4.10 release.
</p>
<ul>
<li>
Added functionality
<ul>
<li>
#
<a href="https://github.com/RediSearch/RediSearch/issues/731">
731
</a>
Add index aliasing. This allows users to provide (or remove) ‘links’ to indexes. The commands are FT.ALIASADD, FT.ALIASDEL, and FT.ALIASUPDATE.
</li>
</ul>
</li>
</ul>
<h2 id="v1410-28-may-2019">
v1.4.10 (28 May 2019)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Fix memory leak when combining SORT with APPLY on FT.AGGREGATE
</li>
</ul>
<h2 id="v149-18-may-2019">
v1.4.9 (18 May 2019)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Fork GC will now squash the empty blocks of the inverted indexes.
</li>
<li>
Fix invalid memory access when using aggregate with GROUPBY.
</li>
<li>
Fix issue where using limit with SORTBY might return duplicate results.
</li>
</ul>
<p>
Known Issue:
</p>
<ul>
<li>
Memory leak when combining SORT and APPLY in FT.AGGREGATE. This issue is fixed on 1.4.10. It's recommended to skip directly to 1.4.10.
</li>
</ul>
<h2 id="v148-29-april-2019">
v1.4.8 (29 April 2019)
</h2>
<p>
Update urgency: Low
</p>
<p>
Technical release, no changes nor fixes.
</p>
<h2 id="v147-29-april-2019">
v1.4.7 (29 April 2019)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Fix issue where Dropping and recreating the same index while querying might cause crashes.
</li>
</ul>
<h2 id="v146-8-april-2019">
v1.4.6 (8 April 2019)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Loading a potentially corrupted RDB files generated by versions lower than 1.4
</li>
<li>
Fix issue where
<code>
REPLACE PARTIAL
</code>
might not work properly (#
<a href="https://github.com/RediSearch/RediSearch/issues/621">
621
</a>
)
</li>
</ul>
<h2 id="v145-march-2019">
v1.4.5 (March 2019)
</h2>
<p>
Update urgency: Low
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Fixed issue where FORK GC causing redis rdb fork to fail
</li>
</ul>
<h2 id="v144-21-february-2019">
v1.4.4 (21 February 2019)
</h2>
<p>
Update urgency: Low
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ul>
<li>
Fixed memory leak on Fork GC
</li>
<li>
Fixed key close after releasing GIL on Fork GC (might cause crashed on rare situations)
</li>
</ul>
<h2 id="v143-4-february-2019">
v1.4.3 (4 February 2019)
</h2>
<p>
Update urgency: Low
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes for issues found after the previous release .
</p>
<p>
Main Fixes:
</p>
<ol>
<li>
Fixed memory leak on mempool destroy
</li>
<li>
Fixed process crash when running with fork GC (preview)
</li>
<li>
Fixed fork GC (preview) deadlock when using Tags
</li>
<li>
Fixed memory leaks on index creation and deletion
</li>
</ol>
<h2 id="v142-27-november-2018">
v1.4.2 (27 November 2018)
</h2>
<p>
Update urgency: Low
</p>
<p>
This is a maintenance release for version 1.4.
</p>
<p>
This release improves overall stability and provides fixes to issues found.
</p>
<h2 id="v141-12-november-2018">
v1.4.1 (12 November 2018)
</h2>
<p>
Update urgency: Medium
</p>
<p>
This is a maintenance release for version 1.4, with the next version planned for release being 2.0.
</p>
<p>
This release improves overall stability and focuses on performance improvements of the garbage collector. It also includes:
</p>
<ul>
<li>
New: Runtime Configuration
</li>
<li>
Change: Unlimited Autocomplete Results
</li>
</ul>
<h3 id="garbage-collector">
Garbage collector
</h3>
<p>
RediSearch employs a garbage collector that removes deleted documents from the internal data structures.
</p>
<p>
In this release the garbage collection mechanism was improved in terms of efficiency, i.e. the amount of memory it reclaims, as well as in terms of performance (i.e. it is faster). The improved mechanism uses forked threads. Additional details can be found in this post:
<a href="https://redislabs.com/blog/increased-garbage-collection-performance-redisearch-1-4-1/">
How We Increased Garbage Collection Performance with RediSearch 1.4.1
</a>
.
</p>
<p>
The improved collection mechanism is currently *
<em>
experimental
</em>
- and is not enabled by default. Enabling the new garbage collection mechanism requires setting the
<code>
GC_POLICY
</code>
configuration option to
<code>
FORK
</code>
at load time, for example:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">redis-server --loadmodule ./redisearch.so GC_POLICY FORK
</span></span></code></pre>
</div>
<h3 id="runtime-configuration">
Runtime configuration
</h3>
<p>
RediSearch's
<a href="/docs/latest/develop/interact/search-and-query/basic-constructs/configuration-parameters/">
configuration
</a>
is applied via arguments passed to the module at load time. This release introduces the new
<code>
FT.CONFIG
</code>
command that allows to retrieve the current configuration as well as change it during runtime.
</p>
<h3 id="unlimited-autocomplete-results">
Unlimited autocomplete results
</h3>
<p>
This version removes the limit of 10 results from
<code>
FT.SUGGET
</code>
- you can set the
<code>
MAX num
</code>
as high as needed.
</p>
<h2 id="v140-august-2018">
v1.4.0 (August 2018)
</h2>
<p>
**Update urgency:*- Medium - mainly due to numerous fixes
</p>
<p>
This version improves overall stability and performance of RediSearch. It also delivers better support for use cases in which documents are continuously updated. New features:
</p>
<ul>
<li>
Conditional updates
</li>
<li>
Schema modification
</li>
<li>
Query spelling correction
</li>
<li>
Phonetic matching
</li>
<li>
Enhancement: More fuzziness in search
</li>
</ul>
<h3 id="continuous-updates">
Continuous updates
</h3>
<p>
Like most search engines, RediSearch was designed for maintaining append-mostly indices. To update an existing document, the document is actually replaced - that is deleted and added to the index.
</p>
<p>
Because RediSearch provides realtime indexing and searching, it is sometimes used to search near-realtime data (or the results of its processing). In such cases, the number of indexed documents stays mostly static, but their contents are continuously updated.
</p>
<p>
To support this use case, RediSearch has been reworked internally to use 64-bit internal document IDs so that an index can sustain high update throughputs without overflowing. Furthermore and as a result, significant effort has been put into improving memory management and garbage collection.
</p>
<h3 id="conditional-updates">
Conditional updates
</h3>
<p>
The
<code>
IF
</code>
subcommand has been add to
<code>
FT.ADD
</code>
. When used with the existing
<code>
REPLACE [PARTIAL]
</code>
subcommand, the document will be updated only if the condition provided evaluates to a truth value, otherwise a special
<code>
NOADD
</code>
reply is returned.
</p>
<h3 id="schema-modification">
Schema modification
</h3>
<p>
The
<code>
FT.ALTER
</code>
command has been introduced, and provides the ability to add new fields to the definition of an existing index. The contents of such newly-added fields are indexed only for new or updated documents.
</p>
<h3 id="query-spelling-correction">
Query spelling correction
</h3>
<p>
Query spelling correction, a.k.a "did you mean", is now provided via the
<code>
FT.SPELLCHECK
</code>
command. It enables generating suggestions for search terms that could be misspelled. For more details see
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/spellcheck/">
Query Spelling Correction
</a>
.
</p>
<h3 id="phonetic-matching">
Phonetic matching
</h3>
<p>
Phonetic matching, a.k.a "Jon or John?", is now supported via the
<code>
PHONETIC
</code>
text field attribute. The terms in such fields are also indexed by their phonetic equivalents, and search results include these by default. For more details see
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/phonetic_matching/">
Phonetic Matching
</a>
.
</p>
<h3 id="more-fuzziness-in-search">
More fuzziness in search
</h3>
<p>
The fuzzy match operator, '%', can now be repeated up to three times to specify the Levenshtein distance. That means that the queries
<code>
%hello%
</code>
,
<code>
%%hello%%
</code>
and
<code>
%%%hello%%%
</code>
will perform fuzzy matching on 'hello' for all terms with LD of 1, 2 and 3, respectively.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisearch/redisearch-1.4-release-notes/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage databases
</h1>
<p class="text-lg -mt-5 mb-10">
This page will help you find database management information in the Databases section.
</p>
<p>
You can manage your Redis Enterprise Software databases with several different tools:
</p>
<ul>
<li>
Cluster Manager UI (the web-based user interface)
</li>
<li>
Command-line tools (
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/">
<code>
rladmin
</code>
</a>
,
<a href="/docs/latest/develop/tools/cli/">
<code>
redis-cli
</code>
</a>
,
<a href="/docs/latest/operate/rs/references/cli-utilities/crdb-cli/">
<code>
crdb-cli
</code>
</a>
)
</li>
<li>
<a href="/docs/latest/operate/rs/references/rest-api/">
REST API
</a>
</li>
</ul>
<nav>
<a href="/docs/latest/operate/rs/databases/create/">
Create a Redis Enterprise Software database
</a>
<p>
Create a database with Redis Enterprise Software.
</p>
<a href="/docs/latest/operate/rs/databases/configure/">
Configure database settings
</a>
<p>
Configure settings specific to each database.
</p>
<a href="/docs/latest/operate/rs/databases/connect/">
Connect to a database
</a>
<p>
Learn how to connect your application to a Redis database hosted by Redis Enterprise Software and test your connection.
</p>
<a href="/docs/latest/operate/rs/databases/import-export/">
Import and export data
</a>
<p>
How to import, export, flush, and migrate your data.
</p>
<a href="/docs/latest/operate/rs/databases/migrate-shards/">
Migrate database shards
</a>
<p>
How to migrate database shards to other nodes in a Redis Software cluster.
</p>
<a href="/docs/latest/operate/rs/databases/recover/">
Recover a failed database
</a>
<p>
Recover a database after the cluster fails or the database is corrupted.
</p>
<a href="/docs/latest/operate/rs/databases/delete/">
Delete databases
</a>
<p>
Delete a database from the Cluster Manager UI.
</p>
<a href="/docs/latest/operate/rs/databases/active-active/">
Active-Active geo-distributed Redis
</a>
<p>
Overview of the Active-Active database in Redis Enterprise Software
</p>
<a href="/docs/latest/operate/rs/databases/auto-tiering/">
Auto Tiering
</a>
<p>
Auto Tiering enables your data to span both RAM and dedicated flash memory.
</p>
<a href="/docs/latest/operate/rs/databases/durability-ha/">
Durability and high availability
</a>
<p>
Overview of Redis Enterprise durability features such as replication, clustering, and rack-zone awareness.
</p>
<a href="/docs/latest/operate/rs/databases/memory-performance/">
Memory and performance
</a>
<p>
Learn more about managing your memory and optimizing performance for your database.
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/clients/pools-and-muxing/.html | <section class="prose w-full py-12">
<h1>
Connection pools and multiplexing
</h1>
<p class="text-lg -mt-5 mb-10">
Manage Redis connections efficiently
</p>
<p>
Redis example code generally opens a connection, demonstrates
a command or feature, and then closes. Real-world code typically
has short bursts of communication with the server and periods of
inactivity in between. Opening and closing connections
involves some overhead and leads to inefficiency if you do
it frequently. This means that you can improve the performance of production
code by making as few separate connections as possible.
</p>
<p>
Managing connections in your own code can be tricky, so the Redis
client libraries give you some help. The two basic approaches to
connection management are called
<em>
connection pooling
</em>
and
<em>
multiplexing
</em>
.
The
<a href="/docs/latest/develop/clients/redis-py/">
<code>
redis-py
</code>
</a>
,
<a href="/docs/latest/develop/clients/jedis/">
<code>
jedis
</code>
</a>
, and
<a href="/docs/latest/develop/clients/go/">
<code>
go-redis
</code>
</a>
clients support
connection pooling, while
<a href="/docs/latest/develop/clients/dotnet/">
<code>
NRedisStack
</code>
</a>
supports multiplexing.
<a href="/docs/latest/develop/clients/lettuce/">
<code>
Lettuce
</code>
</a>
supports both approaches.
</p>
<h2 id="connection-pooling">
Connection pooling
</h2>
<p>
When you initialize a connection pool, the client opens a small number
of connections and adds them to the pool.
</p>
<a href="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolInit.drawio.svg" sdata-lightbox="/images/dev/connect/pool-and-mux/ConnPoolInit.drawio.svg">
<img src="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolInit.drawio.svg"/>
</a>
<p>
Each time you "open" a connection
from the pool, the client returns one of these existing
connections and notes the fact that it is in use.
</p>
<a href="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolInUse.drawio.svg" sdata-lightbox="/images/dev/connect/pool-and-mux/ConnPoolInUse.drawio.svg">
<img src="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolInUse.drawio.svg"/>
</a>
<p>
When you later "close"
the connection, the client puts it back into the pool of available
connections without actually closing it.
</p>
<a href="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolDiscon.drawio.svg" sdata-lightbox="/images/dev/connect/pool-and-mux/ConnPoolDiscon.drawio.svg">
<img src="/docs/latest/images/dev/connect/pool-and-mux/ConnPoolDiscon.drawio.svg"/>
</a>
<p>
If all connections in the pool are in use but the app needs more, then
the client can simply open new connections as necessary. In this way, the client
eventually finds the right number of connections to satisfy your
app's demands.
</p>
<h2 id="multiplexing">
Multiplexing
</h2>
<p>
Instead of pooling several connections, a multiplexer keeps a
single connection open and uses it for all traffic between the
client and the server. The "connections" returned to your code are
used to identify where to send the response data from your commands.
</p>
<a href="/docs/latest/images/dev/connect/pool-and-mux/ConnMux.drawio.svg" sdata-lightbox="/images/dev/connect/pool-and-mux/ConnMux.drawio.svg">
<img src="/docs/latest/images/dev/connect/pool-and-mux/ConnMux.drawio.svg"/>
</a>
<p>
Note that it is not a problem if the multiplexer receives several commands close
together in time. When this happens, the multiplexer can often combine the commands into a
<a href="/docs/latest/develop/use/pipelining/">
pipeline
</a>
, which
improves efficiency.
</p>
<p>
Multiplexing offers high efficiency but works transparently without requiring
any special code to enable it in your app. The main disadvantage of multiplexing compared to
connection pooling is that it can't support the blocking "pop" commands (such as
<a href="/docs/latest/commands/blpop/">
<code>
BLPOP
</code>
</a>
) since these would stall the
connection for all callers.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/clients/pools-and-muxing/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/databases/auto-tiering/quickstart/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Auto Tiering quick start
</h1>
<p class="text-lg -mt-5 mb-10">
Get started with Auto Tiering quickly, creating a cluster and database using flash storage.
</p>
<p>
This page guides you through a quick setup of
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
Auto Tiering
</a>
with a single node for testing and demo purposes.
</p>
<p>
For production environments, you can find more detailed installation instructions in the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/">
install and setup
</a>
section.
</p>
<p>
The steps to set up a Redis Enterprise Software cluster using Auto Tiering
with a single node are:
</p>
<ol>
<li>
Install Redis Enterprise Software or run it in a Docker
container.
</li>
<li>
Set up a Redis Enterprise Software cluster with Auto Tiering.
</li>
<li>
Create a new database with Auto Tiering enabled.
</li>
<li>
Connect to your new database.
</li>
</ol>
<h2 id="install-redis-enterprise-software">
Install Redis Enterprise Software
</h2>
<h3 id="bare-metal-vm-cloud-instance">
Bare metal, VM, Cloud instance
</h3>
<p>
To install on bare metal, a virtual machine, or an instance:
</p>
<ol>
<li>
<p>
Download the binaries from the
<a href="https://cloud.redis.io/#/sign-up/software?direct=true">
Redis Enterprise download center
</a>
.
</p>
</li>
<li>
<p>
Upload the binaries to a Linux-based operating system.
</p>
</li>
<li>
<p>
Extract the image:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">tar -vxf <downloaded tar file name>
</span></span></code></pre>
</div>
</li>
<li>
<p>
After the
<code>
tar
</code>
command completes, you can find a new
<code>
install.sh
</code>
script in the current directory:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo ./install.sh -y
</span></span></code></pre>
</div>
</li>
</ol>
<h3 id="dockerbased-installation">
Docker-based installation
</h3>
<p>
For testing purposes, you can run a Redis Enterprise Software
Docker container on Windows, MacOS, and Linux.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">docker run -d --cap-add sys_resource --name rp -p 8443:8443 -p 12000:12000 redislabs/redis:latest
</span></span></code></pre>
</div>
<h2 id="prepare-and-format-flash-memory">
Prepare and format flash memory
</h2>
<p>
After you
<a href="#install-redis-enterprise-software">
install Redis Enterprise Software
</a>
, use the
<code>
prepare_flash
</code>
script to prepare and format flash memory:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo /opt/redislabs/sbin/prepare_flash.sh
</span></span></code></pre>
</div>
<p>
This script finds unformatted disks and mounts them as RAID partitions in
<code>
/var/opt/redislabs/flash
</code>
.
</p>
<p>
To verify the disk configuration, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo lsblk
</span></span></code></pre>
</div>
<h2 id="set-up-a-clusterand-enable-auto-tiering">
Set up a cluster and enable Auto Tiering
</h2>
<ol>
<li>
<p>
Direct your browser to
<code>
https://localhost:8443
</code>
on the host machine to
see the Redis Enterprise Software Cluster Manager UI.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Depending on your browser, you may see a certificate error.
Choose "continue to the website" to go to the setup screen.
</div>
</div>
</li>
<li>
<p>
Select
<strong>
Create new cluster
</strong>
.
</p>
</li>
<li>
<p>
Set up account credentials for a cluster administrator, then select
<strong>
Next
</strong>
to proceed to cluster setup.
</p>
</li>
<li>
<p>
Enter your cluster license key if you have one. Otherwise, the cluster uses the trial version.
</p>
</li>
<li>
<p>
Provide a cluster FQDN such as
<code>
mycluster.local
</code>
, then select
<strong>
Next
</strong>
.
</p>
</li>
<li>
<p>
In the
<strong>
Storage configuration
</strong>
section, turn on the
<strong>
Enable flash storage
</strong>
toggle.
</p>
</li>
<li>
<p>
Select
<strong>
Create cluster
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
OK
</strong>
to confirm that you are aware of the replacement of the HTTPS TLS
certificate on the node, and proceed through the browser warning.
</p>
</li>
</ol>
<h2 id="create-a-database">
Create a database
</h2>
<p>
On the
<strong>
Databases
</strong>
screen:
</p>
<ol>
<li>
<p>
Select
<strong>
Quick database
</strong>
.
</p>
</li>
<li>
<p>
Verify
<strong>
Flash
</strong>
is selected for
<strong>
Runs on
</strong>
.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/quick-db-flash.png" sdata-lightbox="/images/rs/screenshots/databases/quick-db-flash.png">
<img alt="Create a quick database with Runs on Flash selected." src="/docs/latest/images/rs/screenshots/databases/quick-db-flash.png"/>
</a>
</li>
<li>
<p>
Enter
<code>
12000
</code>
for the endpoint
<strong>
Port
</strong>
number.
</p>
</li>
<li>
<p>
<em>
(Optional)
</em>
Select
<strong>
Full options
</strong>
to see available alerts.
</p>
</li>
<li>
<p>
Select
<strong>
Create
</strong>
.
</p>
</li>
</ol>
<p>
You now have a database with Auto Tiering enabled!
</p>
<h2 id="connect-to-your-database">
Connect to your database
</h2>
<p>
You are ready to connect to your database to store data. See the
<a href="/docs/latest/operate/rs/7.4/databases/connect/test-client-connectivity/">
test connectivity
</a>
page to learn how to connect to your database.
</p>
<h2 id="next-steps">
Next steps
</h2>
<p>
If you want to generate load against the
database or add a bunch of data for cluster testing, see the
<a href="/docs/latest/operate/rs/7.4/clusters/optimize/memtier-benchmark/">
memtier_benchmark quick start
</a>
for help.
</p>
<p>
To see the true performance and scale of Auto Tiering, you must tune your I/O path and set the flash path to the mounted path of SSD or NVMe flash memory as that is what it is designed to run on. For more information, see
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
Auto Tiering
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/databases/auto-tiering/quickstart/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/highlight/.html | <section class="prose w-full py-12">
<h1>
Highlighting
</h1>
<p class="text-lg -mt-5 mb-10">
Highlighting full-text results
</p>
<p>
Redis Stack uses advanced algorithms for highlighting and summarizing, which enable only the relevant portions of a document to appear in response to a search query. This feature allows users to immediately understand the relevance of a document to their search criteria, typically highlighting the matching terms in bold text.
</p>
<h2 id="command-syntax">
Command syntax
</h2>
<pre tabindex="0"><code>FT.SEARCH ...
SUMMARIZE [FIELDS {num} {field}] [FRAGS {numFrags}] [LEN {fragLen}] [SEPARATOR {sepstr}]
HIGHLIGHT [FIELDS {num} {field}] [TAGS {openTag} {closeTag}]
</code></pre>
<p>
There are two sub-commands used for highlighting. The first is
<code>
HIGHLIGHT
</code>
, which surrounds matching text with an open and/or close tag. The second is
<code>
SUMMARIZE
</code>
, which splits a field into contextual fragments surrounding the found terms. It is possible to summarize a field, highlight a field, or perform both actions in the same query.
</p>
<h3 id="summarization">
Summarization
</h3>
<pre tabindex="0"><code>FT.SEARCH ...
SUMMARIZE [FIELDS {num} {field}] [FRAGS {numFrags}] [LEN {fragLen}] [SEPARATOR {sepStr}]
</code></pre>
<p>
Summarization will fragment the text into smaller sized snippets, each of which containing the found term(s) and some additional surrounding context.
</p>
<p>
Redis Stack can perform summarization using the
<code>
SUMMARIZE
</code>
keyword. If no additional arguments are passed, all returned fields are summarized using built-in defaults.
</p>
<p>
The
<code>
SUMMARIZE
</code>
keyword accepts the following arguments:
</p>
<ul>
<li>
<p>
<strong>
<code>
FIELDS
</code>
</strong>
: If present, it must be the first argument. This should be followed
by the number of fields to summarize, which itself is followed by a list of
fields. Each field is summarized. If no
<code>
FIELDS
</code>
directive is passed,
then all returned fields are summarized.
</p>
</li>
<li>
<p>
<strong>
<code>
FRAGS
</code>
</strong>
: The number of fragments to be returned. If not specified, a default is 3.
</p>
</li>
<li>
<p>
<strong>
<code>
LEN
</code>
</strong>
: The number of context words each fragment should contain. Context
words surround the found term. A higher value will return a larger block of
text. If not specified, the default value is 20.
</p>
</li>
<li>
<p>
<strong>
<code>
SEPARATOR
</code>
</strong>
: The string used to divide individual summary snippets.
The default is
<code>
...
</code>
which is common among search engines, but you may
override this with any other string if you desire to programmatically divide the snippets
later on. You may also use a newline sequence, as newlines are stripped from the
result body during processing.
</p>
</li>
</ul>
<h3 id="highlighting">
Highlighting
</h3>
<pre tabindex="0"><code>FT.SEARCH ... HIGHLIGHT [FIELDS {num} {field}] [TAGS {openTag} {closeTag}]
</code></pre>
<p>
Highlighting will surround the found term (and its variants) with a user-defined pair of tags. This may be used to display the matched text in a different typeface using a markup language, or to otherwise make the text appear differently.
</p>
<p>
Redis Stack performs highlighting using the
<code>
HIGHLIGHT
</code>
keyword. If no additional arguments are passed, all returned fields are highlighted using built-in defaults.
</p>
<p>
The
<code>
HIGHLIGHT
</code>
keyword accepts the following arguments:
</p>
<ul>
<li>
<p>
<strong>
<code>
FIELDS
</code>
</strong>
: If present, it must be the first argument. This should be followed
by the number of fields to highlight, which itself is followed by a list of
fields. Each field present is highlighted. If no
<code>
FIELDS
</code>
directive is passed,
then all returned fields are highlighted.
</p>
</li>
<li>
<p>
<strong>
<code>
TAGS
</code>
</strong>
: If present, it must be followed by two strings. The first string is prepended
to each matched term. The second string is appended to each matched term. If no
<code>
TAGS
</code>
are
specified, a built-in tag pair is prepended and appended to each matched term.
</p>
</li>
</ul>
<h4 id="field-selection">
Field selection
</h4>
<p>
If no specific fields are passed to the
<code>
RETURN
</code>
,
<code>
SUMMARIZE
</code>
, or
<code>
HIGHLIGHT
</code>
keywords, then all of a document's fields are returned. However, if any of these keywords contain a
<code>
FIELD
</code>
directive, then the
<code>
SEARCH
</code>
command will only return the sum total of all fields enumerated in any of those directives.
</p>
<p>
The
<code>
RETURN
</code>
keyword is treated specially, as it overrides any fields specified in
<code>
SUMMARIZE
</code>
or
<code>
HIGHLIGHT
</code>
.
</p>
<p>
In the command
<code>
RETURN 1 foo SUMMARIZE FIELDS 1 bar HIGHLIGHT FIELDS 1 baz
</code>
, the fields
<code>
foo
</code>
is returned as-is, while
<code>
bar
</code>
and
<code>
baz
</code>
are not returned, because
<code>
RETURN
</code>
was specified, but did not include those fields.
</p>
<p>
In the command
<code>
SUMMARIZE FIELDS 1 bar HIGHLIGHT FIELDS 1 baz
</code>
,
<code>
bar
</code>
is returned summarized and
<code>
baz
</code>
is returned highlighted.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/highlight/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bf.madd.html | <section class="prose w-full py-12">
<h1 class="command-name">
BF.MADD
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BF.MADD key item [item ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k * n), where k is the number of hash functions and n is the number of items
</dd>
</dl>
<p>
Adds one or more items to a Bloom filter.
</p>
<p>
This command is similar to
<a href="/docs/latest/commands/bf.add/">
<code>
BF.ADD
</code>
</a>
, except that you can add more than one item.
</p>
<p>
This command is similar to
<a href="/docs/latest/commands/bf.insert/">
<code>
BF.INSERT
</code>
</a>
, except that the error rate, capacity, and expansion cannot be specified.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a Bloom filter to add the items to.
</p>
<p>
If
<code>
key
</code>
does not exist - a new Bloom filter is created with default error rate, capacity, and expansion (see
<a href="/docs/latest/commands/bf.reserve/">
<code>
BF.RESERVE
</code>
</a>
).
</p>
</details>
<details open="">
<summary>
<code>
item...
</code>
</summary>
<p>
One or more items to add.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
where each element is either
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
- where "1" means that the item has been added successfully, and "0" means that such item was already added to the filter (which could be wrong)
</li>
<li>
[] when the item cannot be added because the filter is full
</li>
</ul>
</li>
<li>
[] on error (invalid arguments, wrong key type, etc.)
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> BF.MADD bf item1 item2 item2
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bf.madd/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/bdbs/stats/last/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Latest database stats requests
</h1>
<p class="text-lg -mt-5 mb-10">
Most recent database statistics requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-bdbs-stats-last">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/stats/last
</code>
</td>
<td>
Get most recent stats for all databases
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-stats-last">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/stats/last/{uid}
</code>
</td>
<td>
Get most recent stats for a specific database
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-bdbs-stats-last">
Get latest stats for all databases
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/stats/last
</span></span></code></pre>
</div>
<p>
Get the most recent statistics for all databases.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_all_bdb_stats">
view_all_bdb_stats
</a>
</td>
<td>
admin
<br/>
cluster_member
<br/>
cluster_viewer
<br/>
db_member
<br/>
db_viewer
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<ol>
<li>
<p>
Without metrics filter (returns all metrics by default)
</p>
<pre tabindex="0"><code>GET /bdbs/stats/last
</code></pre>
</li>
<li>
<p>
With metrics filter
</p>
<pre tabindex="0"><code>GET /bdbs/stats/last?metrics=no_of_keys,used_memory
</code></pre>
</li>
</ol>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
metrics
</td>
<td>
string
</td>
<td>
Comma-separated list of metric names for which we want statistics (default is all). (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/statistics/">
statistics
</a>
for all databases.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<ol>
<li>
<p>
Without metrics filter (returns all metrics by default)
</p>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:37Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:44Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"egress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:44Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"evicted_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"expired_objects"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"instantaneous_ops_per_sec"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"last_req_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"last_res_time"</span><span class="p">:</span> <span class="s2">"1970-01-01T00:00:00Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651336.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"mem_size_lua"</span><span class="p">:</span> <span class="mf">35840.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"monitor_sessions_count"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"other_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"other_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"read_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_connections_received"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_res"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_hits"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_misses"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_req"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"write_res"</span><span class="p">:</span> <span class="mf">0.0</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:37Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:44Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nt">"// Additional BDBs..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
With metrics filter
</p>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"><span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:44Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651576.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:37Z"</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl"><span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:44ZZ"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651440.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-05-28T08:06:37Z"</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nt">"// Additional BDBs.."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
</li>
</ol>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
No bdbs exist
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-stats-last">
Get latest database stats
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/bdbs/stats/last/<span class="o">{</span>int: uid<span class="o">}</span>
</span></span></code></pre>
</div>
<p>
Get the most recent statistics for a specific database.
</p>
<h4 id="permissions">
Permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
<th>
Roles
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_bdb_stats">
view_bdb_stats
</a>
</td>
<td>
admin
<br/>
cluster_member
<br/>
cluster_viewer
<br/>
db_member
<br/>
db_viewer
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /bdbs/stats/last/1?metrics<span class="o">=</span>no_of_keys,used_memory
</span></span></code></pre>
</div>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the requested BDB.
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters-1">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
metrics
</td>
<td>
string
</td>
<td>
Comma-separated list of metric names for which we want statistics (default is all). (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns the most recent
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/statistics/">
statistics
</a>
for a specific database.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-06-23T12:05:08Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"used_memory"</span><span class="p">:</span> <span class="mf">5651576.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"no_of_keys"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-06-23T12:05:03Z"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
bdb does not exist
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
bdb isn't currently active
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4">
503 Service Unavailable
</a>
</td>
<td>
bdb is in recovery state
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/bdbs/stats/last/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/.html | <section class="prose w-full py-12 max-w-none">
<h1>
RedisTimeSeries release notes
</h1>
<p class="text-lg -mt-5 mb-10">
RedisTimeSeries release notes for version 1.12 and earlier
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Version (Release date)
</th>
<th style="text-align:left">
Major changes
</th>
<th style="text-align:left">
Min Redis
<br/>
version
</th>
<th style="text-align:left">
Min cluster
<br/>
version
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.12-release-notes/">
v1.12 (July 2024)
</a>
</td>
<td style="text-align:left">
RedisTimeSeries 1.12 adds a highly requested feature - insertion-filter for close samples.
</td>
<td style="text-align:left">
7.4
</td>
<td style="text-align:left">
7.6 (TBD)
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.10-release-notes/">
v1.10 (July 2023)
</a>
</td>
<td style="text-align:left">
RESP3 support. Performance improvements.
</td>
<td style="text-align:left">
7.2
</td>
<td style="text-align:left">
7.2.4
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.8-release-notes/">
v1.8 (November 2022)
</a>
</td>
<td style="text-align:left">
Added a time-weighted average aggregator, gap filling, ability to control bucket timestamps, ability to control alignment for compaction rules, new reducer types, and ability to include the latest (possibly partial) raw bucket samples when retrieving compactions
</td>
<td style="text-align:left">
6.0.16
</td>
<td style="text-align:left">
6.2.8
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.6-release-notes/">
v1.6 (January 2022)
</a>
</td>
<td style="text-align:left">
Added support for aggregating across multiple time series (multi-key). Can compute queries such as “the maximum observed value of a set of time series” server-side instead of client-side.
</td>
<td style="text-align:left">
6.0.16
</td>
<td style="text-align:left">
6.2.8
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.4-release-notes/">
v1.4 (September 2020)
</a>
</td>
<td style="text-align:left">
Added ability to backfill time series.
</td>
<td style="text-align:left">
5.0.0
</td>
<td style="text-align:left">
6.0.12
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.2-release-notes/">
v1.2 (January 2020)
</a>
</td>
<td style="text-align:left">
Added compression. Stable ingestion time independent of the number of the data points on a time series. API performance improvements. Extended client support.
</td>
<td style="text-align:left">
5.0.0
</td>
<td style="text-align:left">
6.0.12
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/redistimeseries-1.0-release-notes/">
v1.0 (June 2019)
</a>
</td>
<td style="text-align:left">
Downsampling/compaction. Secondary indexing. Aggregation at read time. Integration with Prometheus, Grafana, and Telegraph.
</td>
<td style="text-align:left">
5.0.0
</td>
<td style="text-align:left">
5.4.0
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redistimeseries/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/alert/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Alert object
</h1>
<p class="text-lg -mt-5 mb-10">
An object that contains alert info
</p>
<p>
You can view, configure, and enable various alerts for the cluster.
</p>
<p>
Alerts are bound to a cluster object (such as a
<a href="/docs/latest/operate/rs/references/rest-api/objects/bdb/">
BDB
</a>
or
<a href="/docs/latest/operate/rs/references/rest-api/objects/node/">
node
</a>
), and the cluster's state determines whether the alerts turn on or off.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
<th>
Writable
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
change_time
</td>
<td>
string
</td>
<td>
Timestamp when alert state last changed
</td>
<td>
</td>
</tr>
<tr>
<td>
change_value
</td>
<td>
object
</td>
<td>
Contains data relevant to the evaluation time when the alert went on/off (thresholds, sampled values, etc.)
</td>
<td>
</td>
</tr>
<tr>
<td>
enabled
</td>
<td>
boolean
</td>
<td>
If true, alert is enabled
</td>
<td>
x
</td>
</tr>
<tr>
<td>
severity
</td>
<td>
'DEBUG'
<br/>
'INFO'
<br/>
'WARNING'
<br/>
'ERROR'
<br/>
'CRITICAL'
</td>
<td>
The alert's severity
</td>
<td>
</td>
</tr>
<tr>
<td>
state
</td>
<td>
boolean
</td>
<td>
If true, alert is currently triggered
</td>
<td>
</td>
</tr>
<tr>
<td>
threshold
</td>
<td>
string
</td>
<td>
Represents an alert threshold when applicable
</td>
<td>
x
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/alert/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bf.scandump/.html | <section class="prose w-full py-12">
<h1 class="command-name">
BF.SCANDUMP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BF.SCANDUMP key iterator</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(n), where n is the capacity
</dd>
</dl>
<p>
Begins an incremental save of the Bloom filter.
</p>
<p>
This command is useful for large Bloom filters that cannot fit into the
<a href="/docs/latest/commands/dump/">
<code>
DUMP
</code>
</a>
and
<a href="/docs/latest/commands/restore/">
<code>
RESTORE
</code>
</a>
model.
</p>
<p>
The first time this command is called, the value of
<code>
iter
</code>
should be 0.
</p>
<p>
This command returns successive
<code>
(iter, data)
</code>
pairs until
<code>
(0, NULL)
</code>
to indicate completion.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a Bloom filter to save.
</p>
</details>
<details open="">
<summary>
<code>
iterator
</code>
</summary>
<p>
Iterator value; either 0 or the iterator from a previous invocation of this command
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
of
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
(
<em>
Iterator
</em>
) and [] (
<em>
Data
</em>
).
</p>
<p>
The Iterator is passed as input to the next invocation of
<code>
BF.SCANDUMP
</code>
. If
<em>
Iterator
</em>
is 0, then it means iteration has completed.
</p>
<p>
The iterator-data pair should also be passed to
<a href="/docs/latest/commands/bf.loadchunk/">
<code>
BF.LOADCHUNK
</code>
</a>
when restoring the filter.
</p>
</li>
<li>
<p>
[] on error (invalid arguments, key not found, wrong key type, etc.)
</p>
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> BF.RESERVE bf 0.1 <span class="m">10</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> BF.ADD bf item1
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> BF.SCANDUMP bf <span class="m">0</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x02\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x9a\x99\x99\x99\x99\x99\xa9?J\xf7\xd4\x9e\xde\xf0\x18@\x05\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00"</span>
</span></span><span class="line"><span class="cl">redis> BF.SCANDUMP bf <span class="m">1</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">9</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">"\x01\b\x00\x80\x00\x04 \x00"</span>
</span></span><span class="line"><span class="cl">redis> BF.SCANDUMP bf <span class="m">9</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="s2">""</span>
</span></span><span class="line"><span class="cl">redis> DEL bf
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> BF.LOADCHUNK bf <span class="m">1</span> <span class="s2">"\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x00\x02\x00\x00\x00\b\x00\x00\x00\x00\x00\x00\x00@\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x9a\x99\x99\x99\x99\x99\xa9?J\xf7\xd4\x9e\xde\xf0\x18@\x05\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> BF.LOADCHUNK bf <span class="m">9</span> <span class="s2">"\x01\b\x00\x80\x00\x04 \x00"</span>
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">redis> BF.EXISTS bf item1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span></span></span></code></pre>
</div>
<p>
Python code:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nv">chunks</span> <span class="o">=</span> <span class="o">[]</span>
</span></span><span class="line"><span class="cl"><span class="nv">iter</span> <span class="o">=</span> <span class="m">0</span>
</span></span><span class="line"><span class="cl"><span class="k">while</span> True:
</span></span><span class="line"><span class="cl"> iter, <span class="nv">data</span> <span class="o">=</span> BF.SCANDUMP<span class="o">(</span>key, iter<span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="nv">iter</span> <span class="o">==</span> 0:
</span></span><span class="line"><span class="cl"> <span class="nb">break</span>
</span></span><span class="line"><span class="cl"> <span class="k">else</span>:
</span></span><span class="line"><span class="cl"> chunks.append<span class="o">([</span>iter, data<span class="o">])</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># Load it back</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> chunk in chunks:
</span></span><span class="line"><span class="cl"> iter, <span class="nv">data</span> <span class="o">=</span> chunk
</span></span><span class="line"><span class="cl"> BF.LOADCHUNK<span class="o">(</span>key, iter, data<span class="o">)</span></span></span></code></pre>
</div>
<p>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bf.scandump/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/use/keyspace-notifications.html | <section class="prose w-full py-12">
<h1>
Redis keyspace notifications
</h1>
<p class="text-lg -mt-5 mb-10">
Monitor changes to Redis keys and values in real time
</p>
<p>
Keyspace notifications allow clients to subscribe to Pub/Sub channels in order
to receive events affecting the Redis data set in some way.
</p>
<p>
Examples of events that can be received are:
</p>
<ul>
<li>
All the commands affecting a given key.
</li>
<li>
All the keys receiving an LPUSH operation.
</li>
<li>
All the keys expiring in the database 0.
</li>
</ul>
<p>
Note: Redis Pub/Sub is
<em>
fire and forget
</em>
; that is, if your Pub/Sub client disconnects,
and reconnects later, all the events delivered during the time the client was
disconnected are lost.
</p>
<h3 id="type-of-events">
Type of events
</h3>
<p>
Keyspace notifications are implemented by sending two distinct types of events
for every operation affecting the Redis data space. For instance a
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
operation targeting the key named
<code>
mykey
</code>
in database
<code>
0
</code>
will trigger
the delivering of two messages, exactly equivalent to the following two
<a href="/docs/latest/commands/publish/">
<code>
PUBLISH
</code>
</a>
commands:
</p>
<pre><code>PUBLISH __keyspace@0__:mykey del
PUBLISH __keyevent@0__:del mykey
</code></pre>
<p>
The first channel listens to all the events targeting
the key
<code>
mykey
</code>
and the other channel listens only to
<code>
del
</code>
operation
events on the key
<code>
mykey
</code>
</p>
<p>
The first kind of event, with
<code>
keyspace
</code>
prefix in the channel is called
a
<strong>
Key-space notification
</strong>
, while the second, with the
<code>
keyevent
</code>
prefix,
is called a
<strong>
Key-event notification
</strong>
.
</p>
<p>
In the previous example a
<code>
del
</code>
event was generated for the key
<code>
mykey
</code>
resulting
in two messages:
</p>
<ul>
<li>
The Key-space channel receives as message the name of the event.
</li>
<li>
The Key-event channel receives as message the name of the key.
</li>
</ul>
<p>
It is possible to enable only one kind of notification in order to deliver
just the subset of events we are interested in.
</p>
<h3 id="configuration">
Configuration
</h3>
<p>
By default keyspace event notifications are disabled because while not
very sensible the feature uses some CPU power. Notifications are enabled
using the
<code>
notify-keyspace-events
</code>
of redis.conf or via the
<strong>
CONFIG SET
</strong>
.
</p>
<p>
Setting the parameter to the empty string disables notifications.
In order to enable the feature a non-empty string is used, composed of multiple
characters, where every character has a special meaning according to the
following table:
</p>
<pre><code>K Keyspace events, published with __keyspace@<db>__ prefix.
E Keyevent events, published with __keyevent@<db>__ prefix.
g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ...
$ String commands
l List commands
s Set commands
h Hash commands
z Sorted set commands
t Stream commands
d Module key type events
x Expired events (events generated every time a key expires)
e Evicted events (events generated when a key is evicted for maxmemory)
m Key miss events (events generated when a key that doesn't exist is accessed)
n New key events (Note: not included in the 'A' class)
A Alias for "g$lshztxed", so that the "AKE" string means all the events except "m" and "n".
</code></pre>
<p>
At least
<code>
K
</code>
or
<code>
E
</code>
should be present in the string, otherwise no event
will be delivered regardless of the rest of the string.
</p>
<p>
For instance to enable just Key-space events for lists, the configuration
parameter must be set to
<code>
Kl
</code>
, and so forth.
</p>
<p>
You can use the string
<code>
KEA
</code>
to enable most types of events.
</p>
<h3 id="events-generated-by-different-commands">
Events generated by different commands
</h3>
<p>
Different commands generate different kind of events according to the following list.
</p>
<ul>
<li>
<a href="/docs/latest/commands/append/">
<code>
APPEND
</code>
</a>
generates an
<code>
append
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/copy/">
<code>
COPY
</code>
</a>
generates a
<code>
copy_to
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
generates a
<code>
del
</code>
event for every deleted key.
</li>
<li>
<a href="/docs/latest/commands/expire/">
<code>
EXPIRE
</code>
</a>
and all its variants (
<a href="/docs/latest/commands/pexpire/">
<code>
PEXPIRE
</code>
</a>
,
<a href="/docs/latest/commands/expireat/">
<code>
EXPIREAT
</code>
</a>
,
<a href="/docs/latest/commands/pexpireat/">
<code>
PEXPIREAT
</code>
</a>
) generate an
<code>
expire
</code>
event when called with a positive timeout (or a future timestamp). Note that when these commands are called with a negative timeout value or timestamp in the past, the key is deleted and only a
<code>
del
</code>
event is generated instead.
</li>
<li>
<a href="/docs/latest/commands/hdel/">
<code>
HDEL
</code>
</a>
generates a single
<code>
hdel
</code>
event, and an additional
<code>
del
</code>
event if the resulting hash is empty and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/hexpire/">
<code>
HEXPIRE
</code>
</a>
and all its variants (
<a href="/docs/latest/commands/hpexpireat/">
<code>
HEXPIREAT
</code>
</a>
,
<a href="/docs/latest/commands/hpexpire/">
<code>
HPEXPIRE
</code>
</a>
,
<a href="/docs/latest/commands/hpexpireat/">
<code>
HPEXPIREAT
</code>
</a>
) generate
<code>
hexpire
</code>
events. Furthermore,
<code>
hexpired
</code>
events are generated when fields expire.
</li>
<li>
<a href="/docs/latest/commands/hincrbyfloat/">
<code>
HINCRBYFLOAT
</code>
</a>
generates an
<code>
hincrbyfloat
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/hincrby/">
<code>
HINCRBY
</code>
</a>
generates an
<code>
hincrby
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/hpersist/">
<code>
HPERSIST
</code>
</a>
generates an
<code>
hpersist
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/hset/">
<code>
HSET
</code>
</a>
,
<a href="/docs/latest/commands/hsetnx/">
<code>
HSETNX
</code>
</a>
and
<a href="/docs/latest/commands/hmset/">
<code>
HMSET
</code>
</a>
all generate a single
<code>
hset
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/incrbyfloat/">
<code>
INCRBYFLOAT
</code>
</a>
generates an
<code>
incrbyfloat
</code>
events.
</li>
<li>
<a href="/docs/latest/commands/incr/">
<code>
INCR
</code>
</a>
,
<a href="/docs/latest/commands/decr/">
<code>
DECR
</code>
</a>
,
<a href="/docs/latest/commands/incrby/">
<code>
INCRBY
</code>
</a>
,
<a href="/docs/latest/commands/decrby/">
<code>
DECRBY
</code>
</a>
commands all generate
<code>
incrby
</code>
events.
</li>
<li>
<a href="/docs/latest/commands/linsert/">
<code>
LINSERT
</code>
</a>
generates an
<code>
linsert
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/lmove/">
<code>
LMOVE
</code>
</a>
and
<a href="/docs/latest/commands/blmove/">
<code>
BLMOVE
</code>
</a>
generate an
<code>
lpop
</code>
/
<code>
rpop
</code>
event (depending on the wherefrom argument) and an
<code>
lpush
</code>
/
<code>
rpush
</code>
event (depending on the whereto argument). In both cases the order is guaranteed (the
<code>
lpush
</code>
/
<code>
rpush
</code>
event will always be delivered after the
<code>
lpop
</code>
/
<code>
rpop
</code>
event). Additionally a
<code>
del
</code>
event will be generated if the resulting list is zero length and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/lpop/">
<code>
LPOP
</code>
</a>
generates an
<code>
lpop
</code>
event. Additionally a
<code>
del
</code>
event is generated if the key is removed because the last element from the list was popped.
</li>
<li>
<a href="/docs/latest/commands/lpush/">
<code>
LPUSH
</code>
</a>
and
<a href="/docs/latest/commands/lpushx/">
<code>
LPUSHX
</code>
</a>
generates a single
<code>
lpush
</code>
event, even in the variadic case.
</li>
<li>
<a href="/docs/latest/commands/lrem/">
<code>
LREM
</code>
</a>
generates an
<code>
lrem
</code>
event, and additionally a
<code>
del
</code>
event if the resulting list is empty and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/lset/">
<code>
LSET
</code>
</a>
generates an
<code>
lset
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/ltrim/">
<code>
LTRIM
</code>
</a>
generates an
<code>
ltrim
</code>
event, and additionally a
<code>
del
</code>
event if the resulting list is empty and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/migrate/">
<code>
MIGRATE
</code>
</a>
generates a
<code>
del
</code>
event if the source key is removed.
</li>
<li>
<a href="/docs/latest/commands/move/">
<code>
MOVE
</code>
</a>
generates two events, a
<code>
move_from
</code>
event for the source key, and a
<code>
move_to
</code>
event for the destination key.
</li>
<li>
<a href="/docs/latest/commands/mset/">
<code>
MSET
</code>
</a>
generates a separate
<code>
set
</code>
event for every key.
</li>
<li>
<a href="/docs/latest/commands/persist/">
<code>
PERSIST
</code>
</a>
generates a
<code>
persist
</code>
event if the expiry time associated with key has been successfully deleted.
</li>
<li>
<a href="/docs/latest/commands/rename/">
<code>
RENAME
</code>
</a>
generates two events, a
<code>
rename_from
</code>
event for the source key, and a
<code>
rename_to
</code>
event for the destination key.
</li>
<li>
<a href="/docs/latest/commands/restore/">
<code>
RESTORE
</code>
</a>
generates a
<code>
restore
</code>
event for the key.
</li>
<li>
<a href="/docs/latest/commands/rpoplpush/">
<code>
RPOPLPUSH
</code>
</a>
and
<a href="/docs/latest/commands/brpoplpush/">
<code>
BRPOPLPUSH
</code>
</a>
generate an
<code>
rpop
</code>
event and an
<code>
lpush
</code>
event. In both cases the order is guaranteed (the
<code>
lpush
</code>
event will always be delivered after the
<code>
rpop
</code>
event). Additionally a
<code>
del
</code>
event will be generated if the resulting list is zero length and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/rpop/">
<code>
RPOP
</code>
</a>
generates an
<code>
rpop
</code>
event. Additionally a
<code>
del
</code>
event is generated if the key is removed because the last element from the list was popped.
</li>
<li>
<a href="/docs/latest/commands/rpush/">
<code>
RPUSH
</code>
</a>
and
<a href="/docs/latest/commands/rpushx/">
<code>
RPUSHX
</code>
</a>
generates a single
<code>
rpush
</code>
event, even in the variadic case.
</li>
<li>
<a href="/docs/latest/commands/sadd/">
<code>
SADD
</code>
</a>
generates a single
<code>
sadd
</code>
event, even in the variadic case.
</li>
<li>
<a href="/docs/latest/commands/setrange/">
<code>
SETRANGE
</code>
</a>
generates a
<code>
setrange
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/set/">
<code>
SET
</code>
</a>
and all its variants (
<a href="/docs/latest/commands/setex/">
<code>
SETEX
</code>
</a>
,
<a href="/docs/latest/commands/setnx/">
<code>
SETNX
</code>
</a>
,
<a href="/docs/latest/commands/getset/">
<code>
GETSET
</code>
</a>
) generate
<code>
set
</code>
events. However
<a href="/docs/latest/commands/setex/">
<code>
SETEX
</code>
</a>
will also generate an
<code>
expire
</code>
events.
</li>
<li>
<a href="/docs/latest/commands/sinterstore/">
<code>
SINTERSTORE
</code>
</a>
,
<a href="/docs/latest/commands/sunionstore/">
<code>
SUNIONSTORE
</code>
</a>
,
<a href="/docs/latest/commands/sdiffstore/">
<code>
SDIFFSTORE
</code>
</a>
generate
<code>
sinterstore
</code>
,
<code>
sunionstore
</code>
,
<code>
sdiffstore
</code>
events respectively. In the special case the resulting set is empty, and the key where the result is stored already exists, a
<code>
del
</code>
event is generated since the key is removed.
</li>
<li>
<a href="/docs/latest/commands/smove/">
<code>
SMOVE
</code>
</a>
generates an
<code>
srem
</code>
event for the source key, and an
<code>
sadd
</code>
event for the destination key.
</li>
<li>
<a href="/docs/latest/commands/sort/">
<code>
SORT
</code>
</a>
generates a
<code>
sortstore
</code>
event when
<code>
STORE
</code>
is used to set a new key. If the resulting list is empty, and the
<code>
STORE
</code>
option is used, and there was already an existing key with that name, the result is that the key is deleted, so a
<code>
del
</code>
event is generated in this condition.
</li>
<li>
<a href="/docs/latest/commands/spop/">
<code>
SPOP
</code>
</a>
generates an
<code>
spop
</code>
event, and an additional
<code>
del
</code>
event if the resulting set is empty and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/srem/">
<code>
SREM
</code>
</a>
generates a single
<code>
srem
</code>
event, and an additional
<code>
del
</code>
event if the resulting set is empty and the key is removed.
</li>
<li>
<a href="/docs/latest/commands/xadd/">
<code>
XADD
</code>
</a>
generates an
<code>
xadd
</code>
event, possibly followed an
<code>
xtrim
</code>
event when used with the
<code>
MAXLEN
</code>
subcommand.
</li>
<li>
<a href="/docs/latest/commands/xdel/">
<code>
XDEL
</code>
</a>
generates a single
<code>
xdel
</code>
event even when multiple entries are deleted.
</li>
<li>
<a href="/docs/latest/commands/xgroup-createconsumer/">
<code>
XGROUP CREATECONSUMER
</code>
</a>
generates an
<code>
xgroup-createconsumer
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xgroup-create/">
<code>
XGROUP CREATE
</code>
</a>
generates an
<code>
xgroup-create
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xgroup-delconsumer/">
<code>
XGROUP DELCONSUMER
</code>
</a>
generates an
<code>
xgroup-delconsumer
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xgroup-destroy/">
<code>
XGROUP DESTROY
</code>
</a>
generates an
<code>
xgroup-destroy
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xgroup-setid/">
<code>
XGROUP SETID
</code>
</a>
generates an
<code>
xgroup-setid
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xsetid/">
<code>
XSETID
</code>
</a>
generates an
<code>
xsetid
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/xtrim/">
<code>
XTRIM
</code>
</a>
generates an
<code>
xtrim
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/zadd/">
<code>
ZADD
</code>
</a>
generates a single
<code>
zadd
</code>
event even when multiple elements are added.
</li>
<li>
<a href="/docs/latest/commands/zdiffstore/">
<code>
ZDIFFSTORE
</code>
</a>
,
<a href="/docs/latest/commands/zinterstore/">
<code>
ZINTERSTORE
</code>
</a>
and
<a href="/docs/latest/commands/zunionstore/">
<code>
ZUNIONSTORE
</code>
</a>
respectively generate
<code>
zdiffstore
</code>
,
<code>
zinterstore
</code>
and
<code>
zunionstore
</code>
events. In the special case the resulting sorted set is empty, and the key where the result is stored already exists, a
<code>
del
</code>
event is generated since the key is removed.
</li>
<li>
<a href="/docs/latest/commands/zincrby/">
<code>
ZINCRBY
</code>
</a>
generates a
<code>
zincr
</code>
event.
</li>
<li>
<a href="/docs/latest/commands/zremrangebyrank/">
<code>
ZREMRANGEBYRANK
</code>
</a>
generates a single
<code>
zrembyrank
</code>
event. When the resulting sorted set is empty and the key is generated, an additional
<code>
del
</code>
event is generated.
</li>
<li>
<a href="/docs/latest/commands/zremrangebyscore/">
<code>
ZREMRANGEBYSCORE
</code>
</a>
generates a single
<code>
zrembyscore
</code>
event. When the resulting sorted set is empty and the key is generated, an additional
<code>
del
</code>
event is generated.
</li>
<li>
<a href="/docs/latest/commands/zrem/">
<code>
ZREM
</code>
</a>
generates a single
<code>
zrem
</code>
event even when multiple elements are deleted. When the resulting sorted set is empty and the key is generated, an additional
<code>
del
</code>
event is generated.
</li>
<li>
Every time a key with a time to live associated is removed from the data set because it expired, an
<code>
expired
</code>
event is generated.
</li>
<li>
Every time a key is evicted from the data set in order to free memory as a result of the
<code>
maxmemory
</code>
policy, an
<code>
evicted
</code>
event is generated.
</li>
<li>
Every time a new key is added to the data set, a
<code>
new
</code>
event is generated.
</li>
</ul>
<p>
<strong>
IMPORTANT
</strong>
all the commands generate events only if the target key is really modified. For instance an
<a href="/docs/latest/commands/srem/">
<code>
SREM
</code>
</a>
deleting a non-existing element from a Set will not actually change the value of the key, so no event will be generated.
</p>
<p>
If in doubt about how events are generated for a given command, the simplest
thing to do is to watch yourself:
</p>
<pre><code>$ redis-cli config set notify-keyspace-events KEA
$ redis-cli --csv psubscribe '__key*__:*'
Reading messages... (press Ctrl-C to quit)
"psubscribe","__key*__:*",1
</code></pre>
<p>
At this point use
<code>
redis-cli
</code>
in another terminal to send commands to the
Redis server and watch the events generated:
</p>
<pre><code>"pmessage","__key*__:*","__keyspace@0__:foo","set"
"pmessage","__key*__:*","__keyevent@0__:set","foo"
...
</code></pre>
<h3 id="timing-of-expired-events">
Timing of expired events
</h3>
<p>
Keys with a time to live associated are expired by Redis in two ways:
</p>
<ul>
<li>
When the key is accessed by a command and is found to be expired.
</li>
<li>
Via a background system that looks for expired keys in the background, incrementally, in order to be able to also collect keys that are never accessed.
</li>
</ul>
<p>
The
<code>
expired
</code>
events are generated when a key is accessed and is found to be expired by one of the above systems, as a result there are no guarantees that the Redis server will be able to generate the
<code>
expired
</code>
event at the time the key time to live reaches the value of zero.
</p>
<p>
If no command targets the key constantly, and there are many keys with a TTL associated, there can be a significant delay between the time the key time to live drops to zero, and the time the
<code>
expired
</code>
event is generated.
</p>
<p>
Expired (
<code>
expired
</code>
) events are generated when the Redis server deletes the key and not when the time to live theoretically reaches the value of zero.
</p>
<h3 id="events-in-a-cluster">
Events in a cluster
</h3>
<p>
Every node of a Redis cluster generates events about its own subset of the keyspace as described above. However, unlike regular Pub/Sub communication in a cluster, events' notifications
<strong>
are not
</strong>
broadcasted to all nodes. Put differently, keyspace events are node-specific. This means that to receive all keyspace events of a cluster, clients need to subscribe to each of the nodes.
</p>
<p>
@history
</p>
<ul>
<li>
<code>
>= 6.0
</code>
: Key miss events were added.
</li>
<li>
<code>
>= 7.0
</code>
: Event type
<code>
new
</code>
added
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/use/keyspace-notifications/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/aggregations/.html | <section class="prose w-full py-12">
<h1>
Aggregations
</h1>
<p class="text-lg -mt-5 mb-10">
Groupings, projections, and aggregation functions
</p>
<p>
Aggregations are a way to process the results of a search query. Aggregation allows you to group, sort, and transform your result data, and to extract analytic insights from it. Much like aggregation queries in other databases and search engines, they can be used to create analytics reports, or perform
<a href="https://en.wikipedia.org/wiki/Faceted_search">
faceted search
</a>
style queries.
</p>
<p>
For example, indexing a web-server's logs, you can create a report for unique users by hour, country, or any other breakdown. Or you can create different reports for errors, warnings, etc.
</p>
<h2 id="core-concepts">
Core concepts
</h2>
<p>
The basic idea of an aggregate query is this:
</p>
<ul>
<li>
Perform a search query, filtering for records you wish to process.
</li>
<li>
Build a pipeline of operations that transform the results by zero or more sequences of:
<ul>
<li>
<strong>
Group and reduce
</strong>
: grouping by fields in the results, and applying reducer functions to each group.
</li>
<li>
<strong>
Sort
</strong>
: sort the results based on one or more fields.
</li>
<li>
<strong>
Apply transformations
</strong>
: apply mathematical and string functions on fields in the pipeline, optionally creating new fields or replacing existing ones.
</li>
<li>
<strong>
Limit
</strong>
: limit the result, regardless of how the result is sorted.
</li>
<li>
<strong>
Filter
</strong>
: filter the results (post-query) based on predicates relating to its values.
</li>
</ul>
</li>
</ul>
<p>
The pipeline is dynamic and re-entrant, and every operation can be repeated. For example, you can group by property X, sort the top 100 results by group size, then group by property Y and sort the results by some other property, then apply a transformation on the output.
</p>
<p>
Figure 1: Aggregation Pipeline Example
</p>
<img src="../../img/pipeline.png"/>
<h2 id="aggregate-request-format">
Aggregate request format
</h2>
<p>
The aggregate request's syntax is defined as follows:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sql" data-lang="sql"><span class="line"><span class="cl"><span class="n">FT</span><span class="p">.</span><span class="k">AGGREGATE</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">index_name</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">query_string</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">VERBATIM</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="k">LOAD</span><span class="w"> </span><span class="err">{</span><span class="n">nargs</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">property</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w"> </span><span class="p">...]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">GROUPBY</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">nargs</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">property</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="n">REDUCE</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">FUNC</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">nargs</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">arg</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="k">AS</span><span class="w"> </span><span class="err">{</span><span class="n">name</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="p">]</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">SORTBY</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">nargs</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">string</span><span class="err">}</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="k">MAX</span><span class="w"> </span><span class="err">{</span><span class="n">num</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">APPLY</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="err">{</span><span class="n">EXPR</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="k">AS</span><span class="w"> </span><span class="err">{</span><span class="n">name</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">FILTER</span><span class="w"> </span><span class="err">{</span><span class="n">EXPR</span><span class="p">:</span><span class="n">string</span><span class="err">}</span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="k">LIMIT</span><span class="w"> </span><span class="err">{</span><span class="k">offset</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">num</span><span class="p">:</span><span class="nb">integer</span><span class="err">}</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">...</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="p">[</span><span class="n">PARAMS</span><span class="w"> </span><span class="err">{</span><span class="n">nargs</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">name</span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="n">value</span><span class="err">}</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span><span class="w">
</span></span></span></code></pre>
</div>
<h3 id="parameters-in-detail">
Parameters in detail
</h3>
<p>
Parameters that can take a variable number of arguments are expressed in the
form of
<code>
param {nargs} {property_1... property_N}
</code>
. The first argument to the
parameter is the number of arguments following the parameter. This allows
Redis Stack to avoid a parsing ambiguity in case one of your arguments has the
name of another parameter. For example, to sort by first name, last name, and
country, one would specify
<code>
SORTBY 6 firstName ASC lastName DESC country ASC
</code>
.
</p>
<ul>
<li>
<p>
<strong>
index_name
</strong>
: The index the query is executed against.
</p>
</li>
<li>
<p>
<strong>
query_string
</strong>
: The base filtering query that retrieves the documents. It follows the exact same syntax as the search query, including filters, unions, not, optional, etc.
</p>
</li>
<li>
<p>
<strong>
LOAD {nargs} {property} ...
</strong>
: Load document fields from the document HASH objects. This should be avoided as a general rule of thumb. Fields needed for aggregations should be stored as SORTABLE (and optionally UNF to avoid any normalization), where they are available to the aggregation pipeline with very low latency. LOAD hurts the performance of aggregate queries considerably since every processed record needs to execute the equivalent of HMGET against a Redis key, which when executed over millions of keys, amounts to very high processing times.
The document ID can be loaded using
<code>
@__key
</code>
.
</p>
</li>
<li>
<p>
<strong>
GROUPBY {nargs} {property} ...
</strong>
: Group the results in the pipeline based on one or more properties. Each group should have at least one reducer (See below), a function that handles the group entries, either counting them or performing multiple aggregate operations (see below).
</p>
</li>
<li>
<p>
<strong>
REDUCE {func} {nargs} {arg} ... [AS {name}]
</strong>
: Reduce the matching results in each group into a single record, using a reduction function. For example, COUNT will count the number of records in the group. See the Reducers section below for more details on available reducers.
</p>
<p>
The reducers can have their own property names using the
<code>
AS {name}
</code>
optional argument. If a name is not given, the resulting name will be the name of the reduce function and the group properties. For example, if a name is not given to COUNT_DISTINCT by property
<code>
@foo
</code>
, the resulting name will be
<code>
count_distinct(@foo)
</code>
.
</p>
</li>
<li>
<p>
<strong>
SORTBY {nargs} {property} {ASC|DESC} [MAX {num}]
</strong>
: Sort the pipeline up until the point of SORTBY, using a list of properties. By default, sorting is ascending, but
<code>
ASC
</code>
or
<code>
DESC
</code>
can be added for each property.
<code>
nargs
</code>
is the number of sorting parameters, including ASC and DESC. for example:
<code>
SORTBY 4 @foo ASC @bar DESC
</code>
.
</p>
<p>
<code>
MAX
</code>
is used to optimized sorting, by sorting only for the n-largest elements. Although it is not connected to
<code>
LIMIT
</code>
, you usually need just
<code>
SORTBY … MAX
</code>
for common queries.
</p>
</li>
<li>
<p>
<strong>
APPLY {expr} AS {name}
</strong>
: Apply a one-to-one transformation on one or more properties, and either store the result as a new property down the pipeline, or replace any property using this transformation.
<code>
expr
</code>
is an expression that can be used to perform arithmetic operations on numeric properties, or functions that can be applied on properties depending on their types (see below), or any combination thereof. For example:
<code>
APPLY "sqrt(@foo)/log(@bar) + 5" AS baz
</code>
will evaluate this expression dynamically for each record in the pipeline and store the result as a new property called baz, that can be referenced by further APPLY / SORTBY / GROUPBY / REDUCE operations down the pipeline.
</p>
</li>
<li>
<p>
<strong>
LIMIT {offset} {num}
</strong>
. Limit the number of results to return just
<code>
num
</code>
results starting at index
<code>
offset
</code>
(zero based). AS mentioned above, it is much more efficient to use
<code>
SORTBY … MAX
</code>
if you are interested in just limiting the output of a sort operation.
</p>
<p>
However, limit can be used to limit results without sorting, or for paging the n-largest results as determined by
<code>
SORTBY MAX
</code>
. For example, getting results 50-100 of the top 100 results is most efficiently expressed as
<code>
SORTBY 1 @foo MAX 100 LIMIT 50 50
</code>
. Removing the MAX from SORTBY will result in the pipeline sorting all the records and then paging over results 50-100.
</p>
</li>
<li>
<p>
<strong>
FILTER {expr}
</strong>
. Filter the results using predicate expressions relating to values in each result. The expressions are applied post-query and relate to the current state of the pipeline. See FILTER Expressions below for full details.
</p>
</li>
<li>
<p>
<strong>
PARAMS {nargs} {name} {value}
</strong>
. Define one or more value parameters. Each parameter has a name and a value. Parameters can be referenced in the query string by a
<code>
$
</code>
, followed by the parameter name, e.g.,
<code>
$user
</code>
, and each such reference in the search query to a parameter name is substituted by the corresponding parameter value. For example, with parameter definition
<code>
PARAMS 4 lon 29.69465 lat 34.95126
</code>
, the expression
<code>
@loc:[$lon $lat 10 km]
</code>
would be evaluated to
<code>
@loc:[29.69465 34.95126 10 km]
</code>
. Parameters cannot be referenced in the query string where concrete values are not allowed, such as in field names, e.g.,
<code>
@loc
</code>
</p>
</li>
<li>
</li>
</ul>
<h2 id="example">
Example
</h2>
<p>
A log of visits to a website might look like the following, each record of which has the following fields/properties:
</p>
<ul>
<li>
<strong>
url
</strong>
(text, sortable)
</li>
<li>
<strong>
timestamp
</strong>
(numeric, sortable) - Unix timestamp of visit entry.
</li>
<li>
<strong>
country
</strong>
(tag, sortable)
</li>
<li>
<strong>
user_id
</strong>
(text, sortable, not indexed)
</li>
</ul>
<h3 id="example-1-unique-users-by-hour-ordered-chronologically">
Example 1: unique users by hour, ordered chronologically.
</h3>
<p>
The first step is to determine the index name and the filtering query. A filter query of
<code>
*
</code>
means "get all records":
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "*"
</code></pre>
<p>
Next, group the results by hour. The data contains visit times as unix timestamps in second resolution, so you'll need to extract the hour component of the timestamp. To do so, add an APPLY step that strips the sub-hour information from the timestamp and stores is as a new property,
<code>
hour
</code>
:
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "*"
APPLY "@timestamp - (@timestamp % 3600)" AS hour
</code></pre>
<p>
Next, group the results by hour and count the distinct user ids in each hour. This is done by a GROUPBY/REDUCE step:
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "*"
APPLY "@timestamp - (@timestamp % 3600)" AS hour
GROUPBY 1 @hour
REDUCE COUNT_DISTINCT 1 @user_id AS num_users
</code></pre>
<p>
Next, sort the results by hour, ascending:
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "*"
APPLY "@timestamp - (@timestamp % 3600)" AS hour
GROUPBY 1 @hour
REDUCE COUNT_DISTINCT 1 @user_id AS num_users
SORTBY 2 @hour ASC
</code></pre>
<p>
And as a final step, format the hour as a human readable timestamp. This is done by calling the transformation function
<code>
timefmt
</code>
that formats Unix timestamps. You can specify a format to be passed to the system's
<code>
strftime
</code>
function (
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html">
see documentation
</a>
), but not specifying one is equivalent to specifying
<code>
%FT%TZ
</code>
to
<code>
strftime
</code>
.
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "*"
APPLY "@timestamp - (@timestamp % 3600)" AS hour
GROUPBY 1 @hour
REDUCE COUNT_DISTINCT 1 @user_id AS num_users
SORTBY 2 @hour ASC
APPLY timefmt(@hour) AS hour
</code></pre>
<h3 id="example-2-sort-visits-to-a-specific-url-by-day-and-country">
Example 2: Sort visits to a specific URL by day and country:
</h3>
<p>
The next example filters by the url, transforms the timestamp to its day part, and groups by the day and country, counting the number of visits per group, sorting by day ascending and country descending.
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIndex "@url:\"about.html\""
APPLY "@timestamp - (@timestamp % 86400)" AS day
GROUPBY 2 @day @country
REDUCE count 0 AS num_visits
SORTBY 4 @day ASC @country DESC
</code></pre>
<h2 id="groupby-reducers">
GROUPBY reducers
</h2>
<p>
<code>
GROUPBY
</code>
works similarly to SQL
<code>
GROUP BY
</code>
clauses, and creates groups of results based on one or more properties in each record. For each group, Redis returns the group keys, or the values common to all records in the group, and the results of zero or more
<code>
REDUCE
</code>
clauses.
</p>
<p>
Each
<code>
GROUPBY
</code>
step in the pipeline may be accompanied by zero or more
<code>
REDUCE
</code>
clauses. Reducers apply an accumulation function to each record in the group and reduces them into a single record representing the group. When the processing is complete, all the records upstream of the
<code>
GROUPBY
</code>
step emit their reduced record.
</p>
<p>
For example, the simplest reducer is COUNT, which simply counts the number of records in each group.
</p>
<p>
If multiple
<code>
REDUCE
</code>
clauses exist for a single
<code>
GROUPBY
</code>
step, each reducer works independently on each result and writes its final output once. Each reducer may have its own alias determined using the
<code>
AS
</code>
optional parameter. If
<code>
AS
</code>
is not specified, the alias is the reduce function and its parameters, e.g.
<code>
count_distinct(foo,bar)
</code>
.
</p>
<h3 id="supported-groupby-reducers">
Supported GROUPBY reducers
</h3>
<h4 id="count">
COUNT
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE COUNT 0
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Count the number of records in each group
</p>
<h4 id="count_distinct">
COUNT_DISTINCT
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE COUNT_DISTINCT 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Count the number of distinct values for
<code>
property
</code>
.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The reducer creates a hash-set per group, and hashes each record. This can be memory heavy if the groups are big.
</div>
</div>
<h4 id="count_distinctish">
COUNT_DISTINCTISH
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE COUNT_DISTINCTISH 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Same as COUNT_DISTINCT, provides an approximation instead of an exact count, which consumes less memory and CPU for big groups.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The reducer uses
<a href="https://en.wikipedia.org/wiki/HyperLogLog">
HyperLogLog
</a>
counters per group, at ~3% error rate, and 1024 bytes of constant space per group. This means it is ideal for a few huge groups and not ideal for many small groups. In the former case, it can be an order of magnitude faster and consume much less memory than COUNT_DISTINCT, but again, it does not fit every use case.
</div>
</div>
<h4 id="sum">
SUM
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE SUM 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the sum of all numeric values of a given property in a group. Non-numeric values in the group are counted as 0.
</p>
<h4 id="min">
MIN
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE MIN 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the minimal value of a property, whether it is a string, number, or NULL.
</p>
<h4 id="max">
MAX
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE MAX 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the maximal value of a property, whether it is a string, number or NULL.
</p>
<h4 id="avg">
AVG
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE AVG 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the average value of a numeric property. This is equivalent to reducing by sum and count, and later, applying the ratio of them as an APPLY step.
</p>
<h4 id="stddev">
STDDEV
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE STDDEV 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the
<a href="https://en.wikipedia.org/wiki/Standard_deviation">
standard deviation
</a>
of a numeric property in the group.
</p>
<h4 id="quantile">
QUANTILE
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE QUANTILE 2 {property} {quantile}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the value of a numeric property at a given quantile of the results. Quantile is expressed as a number between 0 and 1. For example, the median can be expressed as the quantile at 0.5, e.g.
<code>
REDUCE QUANTILE 2 @foo 0.5 AS median
</code>
.
</p>
<p>
If multiple quantiles are required, just repeat the QUANTILE reducer for each quantile. For example,
<code>
REDUCE QUANTILE 2 @foo 0.5 AS median REDUCE QUANTILE 2 @foo 0.99 AS p99
</code>
.
</p>
<h4 id="tolist">
TOLIST
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE TOLIST 1 {property}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Merge all distinct values of a given property into a single array.
</p>
<h4 id="first_value">
FIRST_VALUE
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE FIRST_VALUE {nargs} {property} [BY {property} [ASC|DESC]]
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Return the first or top value of a given property in the group, optionally by comparing it to another property. For example, you can extract the name of the oldest user in the group:
</p>
<pre tabindex="0"><code>REDUCE FIRST_VALUE 4 @name BY @age DESC
</code></pre>
<p>
If no
<code>
BY
</code>
is specified, the first value encountered in the group is returned.
</p>
<p>
If you wish to get the top or bottom value in the group sorted by the same value, you are better off using the
<code>
MIN/MAX
</code>
reducers, but the same effect will be achieved by doing
<code>
REDUCE FIRST_VALUE 4 @foo BY @foo DESC
</code>
.
</p>
<h4 id="random_sample">
RANDOM_SAMPLE
</h4>
<p>
<strong>
Format
</strong>
</p>
<pre tabindex="0"><code>REDUCE RANDOM_SAMPLE {nargs} {property} {sample_size}
</code></pre>
<p>
<strong>
Description
</strong>
</p>
<p>
Perform a reservoir sampling of the group elements with a given size, and return an array of the sampled items with an even distribution.
</p>
<h2 id="apply-expressions">
APPLY expressions
</h2>
<p>
<code>
APPLY
</code>
performs a one-to-one transformation on one or more properties in each record. It either stores the result as a new property down the pipeline, or replaces any property using this transformation.
</p>
<p>
The transformations are expressed as a combination of arithmetic expressions and built in functions. Evaluating functions and expressions is recursively nested and can be composed without limit. For example:
<code>
sqrt(log(foo) * floor(@bar/baz)) + (3^@qaz % 6)
</code>
or simply
<code>
@foo/@bar
</code>
.
</p>
<p>
If an expression or a function is applied to values that do not match the expected types, no error is emitted and a NULL value is set as the result.
</p>
<p>
APPLY steps must have an explicit alias determined by the
<code>
AS
</code>
parameter.
</p>
<h3 id="literals-inside-expressions">
Literals inside expressions
</h3>
<ul>
<li>
Numbers are expressed as integers or floating point numbers, e.g.,
<code>
2
</code>
,
<code>
3.141
</code>
, and
<code>
-34
</code>
.
<code>
inf
</code>
and
<code>
-inf
</code>
are acceptable as well.
</li>
<li>
Strings are quoted with either single or double quotes. Single quotes are acceptable inside strings quoted with double quotes and vice versa. Punctuation marks can be escaped with backslashes. e.g.
<code>
"foo's bar"
</code>
,
<code>
'foo\'s bar'
</code>
,
<code>
"foo \"bar\""
</code>
.
</li>
<li>
Any literal or sub-expression can be wrapped in parentheses to resolve ambiguities of operator precedence.
</li>
</ul>
<h3 id="arithmetic-operations">
Arithmetic operations
</h3>
<p>
For numeric expressions and properties, addition (
<code>
+
</code>
), subtraction (
<code>
-
</code>
), multiplication (
<code>
*
</code>
), division (
<code>
/
</code>
), modulo (
<code>
%
</code>
), and power (
<code>
^
</code>
) are supported. Bitwise logical operators are not supported.
</p>
<p>
Note that these operators apply only to numeric values and numeric sub-expressions. Any attempt to multiply a string by a number, for instance, will result in a NULL output.
</p>
<h3 id="list-of-field-apply-functions">
List of field APPLY functions
</h3>
<table>
<thead>
<tr>
<th>
Function
</th>
<th>
Description
</th>
<th>
Example
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
exists(s)
</td>
<td>
Checks whether a field exists in a document.
</td>
<td>
<code>
exists(@field)
</code>
</td>
</tr>
</tbody>
</table>
<h3 id="list-of-numeric-apply-functions">
List of numeric APPLY functions
</h3>
<table>
<thead>
<tr>
<th>
Function
</th>
<th>
Description
</th>
<th>
Example
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
log(x)
</td>
<td>
Return the logarithm of a number, property or subexpression
</td>
<td>
<code>
log(@foo)
</code>
</td>
</tr>
<tr>
<td>
abs(x)
</td>
<td>
Return the absolute number of a numeric expression
</td>
<td>
<code>
abs(@foo-@bar)
</code>
</td>
</tr>
<tr>
<td>
ceil(x)
</td>
<td>
Round to the smallest value not less than x
</td>
<td>
<code>
ceil(@foo/3.14)
</code>
</td>
</tr>
<tr>
<td>
floor(x)
</td>
<td>
Round to largest value not greater than x
</td>
<td>
<code>
floor(@foo/3.14)
</code>
</td>
</tr>
<tr>
<td>
log2(x)
</td>
<td>
Return the logarithm of x to base 2
</td>
<td>
<code>
log2(2^@foo)
</code>
</td>
</tr>
<tr>
<td>
exp(x)
</td>
<td>
Return the exponent of x, e.g.,
<code>
e^x
</code>
</td>
<td>
<code>
exp(@foo)
</code>
</td>
</tr>
<tr>
<td>
sqrt(x)
</td>
<td>
Return the square root of x
</td>
<td>
<code>
sqrt(@foo)
</code>
</td>
</tr>
</tbody>
</table>
<h3 id="list-of-string-apply-functions">
List of string APPLY functions
</h3>
<table>
<thead>
<tr>
<th>
Function
</th>
<th>
</th>
<th>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
upper(s)
</td>
<td>
Return the uppercase conversion of s
</td>
<td>
<code>
upper('hello world')
</code>
</td>
</tr>
<tr>
<td>
lower(s)
</td>
<td>
Return the lowercase conversion of s
</td>
<td>
<code>
lower("HELLO WORLD")
</code>
</td>
</tr>
<tr>
<td>
startswith(s1,s2)
</td>
<td>
Return
<code>
1
</code>
if s2 is the prefix of s1,
<code>
0
</code>
otherwise.
</td>
<td>
<code>
startswith(@field, "company")
</code>
</td>
</tr>
<tr>
<td>
contains(s1,s2)
</td>
<td>
Return the number of occurrences of s2 in s1,
<code>
0
</code>
otherwise. If s2 is an empty string, return
<code>
length(s1) + 1
</code>
.
</td>
<td>
<code>
contains(@field, "pa")
</code>
</td>
</tr>
<tr>
<td>
strlen(s)
</td>
<td>
Return the length of s
</td>
<td>
<code>
strlen(@t)
</code>
</td>
</tr>
<tr>
<td>
substr(s, offset, count)
</td>
<td>
Return the substring of s, starting at
<em>
offset
</em>
and having
<em>
count
</em>
characters.
<br/>
If offset is negative, it represents the distance from the end of the string.
<br/>
If count is -1, it means "the rest of the string starting at offset".
</td>
<td>
<code>
substr("hello", 0, 3)
</code>
<br/>
<code>
substr("hello", -2, -1)
</code>
</td>
</tr>
<tr>
<td>
format( fmt, ...)
</td>
<td>
Use the arguments following
<code>
fmt
</code>
to format a string.
<br/>
Currently the only format argument supported is
<code>
%s
</code>
and it applies to all types of arguments.
</td>
<td>
<code>
format("Hello, %s, you are %s years old", @name, @age)
</code>
</td>
</tr>
<tr>
<td>
matched_terms([max_terms=100])
</td>
<td>
Return the query terms that matched for each record (up to 100), as a list. If a limit is specified, Redis will return the first N matches found, based on query order.
</td>
<td>
<code>
matched_terms()
</code>
</td>
</tr>
<tr>
<td>
split(s, [sep=","], [strip=" "])
</td>
<td>
Split a string by any character in the string sep, and strip any characters in strip. If only s is specified, it is split by commas and spaces are stripped. The output is an array.
</td>
<td>
split("foo,bar")
</td>
</tr>
</tbody>
</table>
<h3 id="list-of-datetime-apply-functions">
List of date/time APPLY functions
</h3>
<table>
<thead>
<tr>
<th>
Function
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
timefmt(x, [fmt])
</td>
<td>
Return a formatted time string based on a numeric timestamp value x.
<br/>
See
<a href="https://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html">
strftime
</a>
for formatting options.
<br/>
Not specifying
<code>
fmt
</code>
is equivalent to
<code>
%FT%TZ
</code>
.
</td>
</tr>
<tr>
<td>
parsetime(timesharing, [fmt])
</td>
<td>
The opposite of timefmt() - parse a time format using a given format string
</td>
</tr>
<tr>
<td>
day(timestamp)
</td>
<td>
Round a Unix timestamp to midnight (00:00) start of the current day.
</td>
</tr>
<tr>
<td>
hour(timestamp)
</td>
<td>
Round a Unix timestamp to the beginning of the current hour.
</td>
</tr>
<tr>
<td>
minute(timestamp)
</td>
<td>
Round a Unix timestamp to the beginning of the current minute.
</td>
</tr>
<tr>
<td>
month(timestamp)
</td>
<td>
Round a unix timestamp to the beginning of the current month.
</td>
</tr>
<tr>
<td>
dayofweek(timestamp)
</td>
<td>
Convert a Unix timestamp to the day number (Sunday = 0).
</td>
</tr>
<tr>
<td>
dayofmonth(timestamp)
</td>
<td>
Convert a Unix timestamp to the day of month number (1 .. 31).
</td>
</tr>
<tr>
<td>
dayofyear(timestamp)
</td>
<td>
Convert a Unix timestamp to the day of year number (0 .. 365).
</td>
</tr>
<tr>
<td>
year(timestamp)
</td>
<td>
Convert a Unix timestamp to the current year (e.g. 2018).
</td>
</tr>
<tr>
<td>
monthofyear(timestamp)
</td>
<td>
Convert a Unix timestamp to the current month (0 .. 11).
</td>
</tr>
</tbody>
</table>
<h3 id="list-of-geo-apply-functions">
List of geo APPLY functions
</h3>
<table>
<thead>
<tr>
<th>
Function
</th>
<th>
Description
</th>
<th>
Example
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
geodistance(field,field)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(@field1,@field2)
</code>
</td>
</tr>
<tr>
<td>
geodistance(field,"lon,lat")
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(@field,"1.2,-3.4")
</code>
</td>
</tr>
<tr>
<td>
geodistance(field,lon,lat)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(@field,1.2,-3.4)
</code>
</td>
</tr>
<tr>
<td>
geodistance("lon,lat",field)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance("1.2,-3.4",@field)
</code>
</td>
</tr>
<tr>
<td>
geodistance("lon,lat","lon,lat")
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance("1.2,-3.4","5.6,-7.8")
</code>
</td>
</tr>
<tr>
<td>
geodistance("lon,lat",lon,lat)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance("1.2,-3.4",5.6,-7.8)
</code>
</td>
</tr>
<tr>
<td>
geodistance(lon,lat,field)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(1.2,-3.4,@field)
</code>
</td>
</tr>
<tr>
<td>
geodistance(lon,lat,"lon,lat")
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(1.2,-3.4,"5.6,-7.8")
</code>
</td>
</tr>
<tr>
<td>
geodistance(lon,lat,lon,lat)
</td>
<td>
Return distance in meters.
</td>
<td>
<code>
geodistance(1.2,-3.4,5.6,-7.8)
</code>
</td>
</tr>
</tbody>
</table>
<pre tabindex="0"><code>FT.AGGREGATE myIdx "*" LOAD 1 location APPLY "geodistance(@location,\"-1.1,2.2\")" AS dist
</code></pre>
<p>
To retrieve the distance:
</p>
<pre tabindex="0"><code>FT.AGGREGATE myIdx "*" LOAD 1 location APPLY "geodistance(@location,\"-1.1,2.2\")" AS dist
</code></pre>
<p>
Note: the geo field must be preloaded using
<code>
LOAD
</code>
.
</p>
<p>
Results can also be sorted by distance:
</p>
<pre tabindex="0"><code>FT.AGGREGATE idx "*" LOAD 1 @location FILTER "exists(@location)" APPLY "geodistance(@location,-117.824722,33.68590)" AS dist SORTBY 2 @dist DESC
</code></pre>
<p>
Note: Make sure no location is missing, otherwise the SORTBY will not return any results.
Use FILTER to make sure you do the sorting on all valid locations.
</p>
<h2 id="filter-expressions">
FILTER expressions
</h2>
<p>
FILTER expressions filter the results using predicates relating to values in the result set.
</p>
<p>
The FILTER expressions are evaluated post-query and relate to the current state of the pipeline. Thus they can be useful to prune the results based on group calculations. Note that the filters are not indexed and will not speed up processing.
</p>
<p>
Filter expressions follow the syntax of APPLY expressions, with the addition of the conditions
<code>
==
</code>
,
<code>
!=
</code>
,
<code>
<
</code>
,
<code>
<=
</code>
,
<code>
>
</code>
,
<code>
>=
</code>
. Two or more predicates can be combined with logical AND (
<code>
&&
</code>
) and OR (
<code>
||
</code>
). A single predicate can be negated with a NOT prefix (
<code>
!
</code>
).
</p>
<p>
For example, filtering all results where the user name is 'foo' and the age is less than 20 is expressed as:
</p>
<pre tabindex="0"><code>FT.AGGREGATE
...
FILTER "@name=='foo' && @age < 20"
...
</code></pre>
<p>
Several filter steps can be added, although at the same stage in the pipeline, it is more efficient to combine several predicates into a single filter step.
</p>
<h2 id="cursor-api">
Cursor API
</h2>
<pre tabindex="0"><code>FT.AGGREGATE ... WITHCURSOR [COUNT {read size} MAXIDLE {idle timeout}]
FT.CURSOR READ {idx} {cid} [COUNT {read size}]
FT.CURSOR DEL {idx} {cid}
</code></pre>
<p>
You can use cursors with
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
, with the
<code>
WITHCURSOR
</code>
keyword. Cursors allow you to
consume only part of the response, allowing you to fetch additional results as needed.
This is much quicker than using
<code>
LIMIT
</code>
with offset, since the query is executed only
once, and its state is stored on the server.
</p>
<p>
To use cursors, specify the
<code>
WITHCURSOR
</code>
keyword in
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
. For example:
</p>
<pre tabindex="0"><code>FT.AGGREGATE idx * WITHCURSOR
</code></pre>
<p>
This will return a response of an array with two elements. The first element is
the actual (partial) result, and the second is the cursor ID. The cursor ID
can then be fed to
<a href="/docs/latest/commands/ft.cursor-read/">
<code>
FT.CURSOR READ
</code>
</a>
repeatedly until the cursor ID is 0, in
which case all results have been returned.
</p>
<p>
To read from an existing cursor, use
<a href="/docs/latest/commands/ft.cursor-read/">
<code>
FT.CURSOR READ
</code>
</a>
. For example:
</p>
<pre tabindex="0"><code>FT.CURSOR READ idx 342459320
</code></pre>
<p>
Assuming
<code>
342459320
</code>
is the cursor ID returned from the
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
request, here is an example in pseudo-code:
</p>
<pre tabindex="0"><code>response, cursor = FT.AGGREGATE "idx" "redis" "WITHCURSOR";
while (1) {
processResponse(response)
if (!cursor) {
break;
}
response, cursor = FT.CURSOR read "idx" cursor
}
</code></pre>
<p>
Note that even if the cursor is 0, a partial result may still be returned.
</p>
<h3 id="cursor-settings">
Cursor settings
</h3>
<h4 id="read-size">
Read size
</h4>
<p>
You can control how many rows are read for each cursor fetch by using the
<code>
COUNT
</code>
parameter. This parameter can be specified both in
<a href="/docs/latest/commands/ft.aggregate/">
<code>
FT.AGGREGATE
</code>
</a>
(immediately after
<code>
WITHCURSOR
</code>
) or in
<a href="/docs/latest/commands/ft.cursor-read/">
<code>
FT.CURSOR READ
</code>
</a>
.
</p>
<p>
The following example will read 10 rows at a time:
</p>
<pre tabindex="0"><code>FT.AGGREGATE idx query WITHCURSOR COUNT 10
</code></pre>
<p>
You can override this setting by also specifying
<code>
COUNT
</code>
in
<code>
CURSOR READ
</code>
. The following example will return at most 50 results:
</p>
<pre tabindex="0"><code>FT.CURSOR READ idx 342459320 COUNT 50
</code></pre>
<p>
The default read size is 1000.
</p>
<h4 id="timeouts-and-limits">
Timeouts and limits
</h4>
<p>
Because cursors are stateful resources that occupy memory on the server, they
have a limited lifetime. To safeguard against orphaned/stale cursors,
cursors have an idle timeout value. If no activity occurs on the cursor before
the idle timeout, the cursor is deleted. The idle timer resets to 0 whenever
the cursor is read from using
<code>
CURSOR READ
</code>
.
</p>
<p>
The default idle timeout is 300000 milliseconds (or 300 seconds). You can modify
the idle timeout using the
<code>
MAXIDLE
</code>
keyword when creating the cursor. Note that
the value cannot exceed the default 300s.
</p>
<p>
For example, to set a limit of ten seconds:
</p>
<pre tabindex="0"><code>FT.AGGREGATE idx query WITHCURSOR MAXIDLE 10000
</code></pre>
<h3 id="other-cursor-commands">
Other cursor commands
</h3>
<p>
Cursors can be explicitly deleted using the
<code>
CURSOR DEL
</code>
command. For example:
</p>
<pre tabindex="0"><code>FT.CURSOR DEL idx 342459320
</code></pre>
<p>
Note that cursors are automatically deleted if all their results have been
returned, or if they have timed out.
</p>
<p>
All idle cursors can be forcefully purged at the same time using
<code>
FT.CURSOR GC idx 0
</code>
command.
By default, Redis Stack uses a lazy throttled approach to garbage collection, which
collects idle cursors every 500 operations, or every second, whichever is later.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/advanced-concepts/aggregations/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.2-release-notes.html | <section class="prose w-full py-12 max-w-none">
<h1>
RedisJSON 2.2 release notes
</h1>
<p class="text-lg -mt-5 mb-10">
Preview of Active-Active support for JSON.
</p>
<h2 id="requirements">
Requirements
</h2>
<p>
RedisJSON v2.2.0 requires:
</p>
<ul>
<li>
Minimum Redis compatibility version (database): 6.0.0
</li>
<li>
Minimum Redis Enterprise Software version (cluster): 6.2.18
</li>
</ul>
<h2 id="v220-july-2022">
v2.2.0 (July 2022)
</h2>
<p>
A preview of RedisJSON 2.2 is available for Free and Fixed subscription plans in Redis Cloud.
</p>
<h3 id="headlines">
Headlines
</h3>
<p>
This release adds support for the JSON data structure as a CRDT (Conflict-free Replicated Data Type) when used with Redis Enterprise
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/active-active/">
Active-Active databases
</a>
.
</p>
<p>
Active-Active JSON requires Redis Enterprise Software v6.2.12. Contact your account manager or support to access the preview of RedisJSON 2.2.
</p>
<h3 id="details">
Details
</h3>
<ul>
<li>
<p>
Enhancements:
</p>
<ul>
<li>
<a href="https://github.com/RedisJSON/RedisJSON/pull/758">
#758
</a>
Add support for
<a href="/docs/latest/commands/copy/">
<code>
COPY
</code>
</a>
</li>
</ul>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisjson/redisjson-2.2-release-notes/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/job_scheduler/backup_job_settings/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Backup job settings object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the backup_job_settings object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
cron_expression
</td>
<td>
string
</td>
<td>
<a href="https://en.wikipedia.org/wiki/Cron#CRON_expression">
CRON expression
</a>
that defines the backup schedule
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/job_scheduler/backup_job_settings/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/bf.info.html | <section class="prose w-full py-12">
<h1 class="command-name">
BF.INFO
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">BF.INFO key [CAPACITY | SIZE | FILTERS | ITEMS | EXPANSION]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
</dl>
<p>
Returns information about a Bloom filter.
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a Bloom filter.
</p>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
CAPACITY
</code>
</summary>
<p>
Return the number of unique items that can be stored in this Bloom filter before scaling would be required (including already added items).
</p>
</details>
<details open="">
<summary>
<code>
SIZE
</code>
</summary>
<p>
Return the memory size: number of bytes allocated for this Bloom filter.
</p>
</details>
<details open="">
<summary>
<code>
FILTERS
</code>
</summary>
<p>
Return the number of sub-filters.
</p>
</details>
<details open="">
<summary>
<code>
ITEMS
</code>
</summary>
<p>
Return the number of items that were added to this Bloom filter and detected as unique (items that caused at least one bit to be set in at least one sub-filter).
</p>
</details>
<details open="">
<summary>
<code>
EXPANSION
</code>
</summary>
<p>
Return the expansion rate.
</p>
</details>
<p>
When no optional argument is specified: return all information fields.
</p>
<h2 id="return-value">
Return value
</h2>
<p>
When no optional argument is specified, returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
with argument name (
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
) and value (
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
) pairs
</li>
<li>
[] on error (invalid arguments, key does not exist, wrong key type, and so on)
</li>
</ul>
<p>
When an optional argument is specified, returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
- argument value
</li>
<li>
[] on error (invalid arguments, key does not exist, wrong key type, and so on)
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> BF.ADD bf1 observation1
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> BF.INFO bf1
</span></span><span class="line"><span class="cl"> 1<span class="o">)</span> Capacity
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">100</span>
</span></span><span class="line"><span class="cl"> 3<span class="o">)</span> Size
</span></span><span class="line"><span class="cl"> 4<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">240</span>
</span></span><span class="line"><span class="cl"> 5<span class="o">)</span> Number of filters
</span></span><span class="line"><span class="cl"> 6<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl"> 7<span class="o">)</span> Number of items inserted
</span></span><span class="line"><span class="cl"> 8<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl"> 9<span class="o">)</span> Expansion rate
</span></span><span class="line"><span class="cl">10<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">2</span>
</span></span><span class="line"><span class="cl">redis> BF.INFO bf1 CAPACITY
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">100</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/bf.info/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/.html | <section class="prose w-full py-12 max-w-none">
<h1>
RedisBloom release notes
</h1>
<p class="text-lg -mt-5 mb-10">
RedisBloom release notes for version 2.8 and earlier
</p>
<table>
<thead>
<tr>
<th style="text-align:left">
Version (Release date)
</th>
<th style="text-align:left">
Major changes
</th>
<th style="text-align:left">
Min Redis
<br/>
version
</th>
<th style="text-align:left">
Min cluster
<br/>
version
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.8-release-notes/">
v2.8 (July 2024)
</a>
</td>
<td style="text-align:left">
RedisBloom 2.8 introduces improvements and bug fixes.
</td>
<td style="text-align:left">
7.4
</td>
<td style="text-align:left">
7.6 (TBD)
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.6-release-notes/">
v2.6 (July 2023)
</a>
</td>
<td style="text-align:left">
RESP3 support. Bug fixes.
</td>
<td style="text-align:left">
7.2
</td>
<td style="text-align:left">
7.2.4
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.4-release-notes/">
v2.4 (November 2022)
</a>
</td>
<td style="text-align:left">
Added t-digest - a probabilistic data structure for estimating quantiles based on a data stream or a large dataset of floating-point values.
</td>
<td style="text-align:left">
6.0.16
</td>
<td style="text-align:left">
6.2.8
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.2-release-notes/">
v2.2 (December 2019)
</a>
</td>
<td style="text-align:left">
BF.INFO returns bloom filter details. CF.INFO returns cuckoo filter details. Scalable bloom and cuckoo filters. Configurable bucket size for cuckoo filters. CMS.INCRBY returns count.
</td>
<td style="text-align:left">
4.0.0
</td>
<td style="text-align:left">
5.0.0
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-2.0-release-notes/">
v2.0 (June 2019)
</a>
</td>
<td style="text-align:left">
Added more probabilistic data structures, including top-K and count-min sketch.
</td>
<td style="text-align:left">
4.0.0
</td>
<td style="text-align:left">
5.0.0
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-1.1-release-notes/">
v1.1 (February 2019)
</a>
</td>
<td style="text-align:left">
Updated version.
</td>
<td style="text-align:left">
4.0.0
</td>
<td style="text-align:left">
5.0.0
</td>
</tr>
<tr>
<td style="text-align:left">
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/redisbloom-1.0-release-notes/">
v1.0 (September 2017)
</a>
</td>
<td style="text-align:left">
First GA release of RedisBloom.
</td>
<td style="text-align:left">
4.0.0
</td>
<td style="text-align:left">
5.0.0
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisbloom/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/getbit/.html | <section class="prose w-full py-12">
<h1 class="command-name">
GETBIT
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">GETBIT key offset</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@bitmap
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Returns the bit value at
<em>
offset
</em>
in the string value stored at
<em>
key
</em>
.
</p>
<p>
When
<em>
offset
</em>
is beyond the string length, the string is assumed to be a
contiguous space with 0 bits.
When
<em>
key
</em>
does not exist it is assumed to be an empty string, so
<em>
offset
</em>
is
always out of range and the value is also assumed to be a contiguous space with
0 bits.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SETBIT mykey 7 1
(integer) 0
redis> GETBIT mykey 0
(integer) 0
redis> GETBIT mykey 7
(integer) 1
redis> GETBIT mykey 100
(integer) 0
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<p>
The bit value stored at
<em>
offset
</em>
, one of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
0
</code>
.
</li>
<li>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
:
<code>
1
</code>
.
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/getbit/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/crdb/health-report/.html | <section class="prose w-full py-12 max-w-none">
<h1>
crdb-cli crdb health-report
</h1>
<p class="text-lg -mt-5 mb-10">
Shows the health report of an Active-Active database.
</p>
<p>
Shows the health report of the API management layer of an Active-Active database.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli crdb health-report --crdb-guid <guid>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
crdb-guid
</td>
<td>
string
</td>
<td>
The GUID of the database (required)
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns the health report of the API management layer of the database.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ crdb-cli crdb health-report --crdb-guid d84f6fe4-5bb7-49d2-a188-8900e09c6f66
</span></span><span class="line"><span class="cl"><span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"active_config_version"</span>:1,
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster_name"</span>:<span class="s2">"cluster2.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"configurations"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"causal_consistency"</span>:false,
</span></span><span class="line"><span class="cl"> <span class="s2">"encryption"</span>:false,
</span></span><span class="line"><span class="cl"> <span class="s2">"featureset_version"</span>:5,
</span></span><span class="line"><span class="cl"> <span class="s2">"instances"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster"</span>:<span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster1.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"url"</span>:<span class="s2">"https:\/\/cluster1.redis.local:9443"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"db_uid"</span>:<span class="s2">""</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"id"</span>:1
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster"</span>:<span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster2.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"url"</span>:<span class="s2">"https:\/\/cluster2.redis.local:9443"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"db_uid"</span>:<span class="s2">"1"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"id"</span>:2
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"database1"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"protocol_version"</span>:1,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"commit-completed"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"version"</span>:1
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"connections"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster1.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"ok"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster2.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"ok"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"guid"</span>:<span class="s2">"d84f6fe4-5bb7-49d2-a188-8900e09c6f66"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"database1"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"connection_error"</span>:null
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"active_config_version"</span>:1,
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster_name"</span>:<span class="s2">"cluster1.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"configurations"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"causal_consistency"</span>:false,
</span></span><span class="line"><span class="cl"> <span class="s2">"encryption"</span>:false,
</span></span><span class="line"><span class="cl"> <span class="s2">"featureset_version"</span>:5,
</span></span><span class="line"><span class="cl"> <span class="s2">"instances"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster"</span>:<span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster1.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"url"</span>:<span class="s2">"https:\/\/cluster1.redis.local:9443"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"db_uid"</span>:<span class="s2">"4"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"id"</span>:1
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"cluster"</span>:<span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster2.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"url"</span>:<span class="s2">"https:\/\/cluster2.redis.local:9443"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"db_uid"</span>:<span class="s2">""</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"id"</span>:2
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"database1"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"protocol_version"</span>:1,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"commit-completed"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"version"</span>:1
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"connections"</span>:<span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster1.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"ok"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"cluster2.redis.local"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"status"</span>:<span class="s2">"ok"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"guid"</span>:<span class="s2">"d84f6fe4-5bb7-49d2-a188-8900e09c6f66"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"name"</span>:<span class="s2">"database1"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"connection_error"</span>:null
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">]</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli/crdb/health-report/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/debuginfo/node/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Current node debug info requests
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the Redis Enterprise Software REST API debuginfo/node requests.
</p>
<div class="banner-article rounded-md" style="background-color: ">
<p>
This REST API path is deprecated as of Redis Enterprise Software version 7.4.2. Use the new path
<a href="/docs/latest/operate/rs/references/rest-api/requests/nodes/debuginfo/">
<code>
/v1/nodes/debuginfo
</code>
</a>
instead.
</p>
</div>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-debuginfo-node">
GET
</a>
</td>
<td>
<code>
/v1/debuginfo/node
</code>
</td>
<td>
Get debug info for the current node
</td>
</tr>
</tbody>
</table>
<h2 id="get-debuginfo-node">
Get debug info for current node
</h2>
<pre><code>GET /v1/debuginfo/node
</code></pre>
<p>
Downloads a tar file that contains debug info for the current node.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_debugging_info">
view_debugging_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /debuginfo/node
</code></pre>
<h3 id="get-response">
Response
</h3>
<p>
Downloads the debug info in a tar file called
<code>
filename.tar.gz
</code>
. Extract the files from the tar file to access the debug info.
</p>
<h4 id="response-headers">
Response headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Content-Type
</td>
<td>
application/x-gzip
</td>
<td>
Media type of request/response body
</td>
</tr>
<tr>
<td>
Content-Length
</td>
<td>
653350
</td>
<td>
Length of the response body in octets
</td>
</tr>
<tr>
<td>
Content-Disposition
</td>
<td>
attachment; filename=debuginfo.tar.gz
</td>
<td>
Display response in browser or download as attachment
</td>
</tr>
</tbody>
</table>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">
500 Internal Server Error
</a>
</td>
<td>
Failed to get debug info.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/debuginfo/node/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/query/exact-match/.html | <section class="prose w-full py-12">
<h1>
Exact match queries
</h1>
<p class="text-lg -mt-5 mb-10">
Perform simple exact match queries
</p>
<p>
An exact match query allows you to select all documents where a field matches a specific value.
</p>
<p>
You can use exact match queries on several field types. The query syntax varies depending on the type.
</p>
<p>
The examples in this article use a schema with the following fields:
</p>
<table>
<thead>
<tr>
<th>
Field name
</th>
<th>
Field type
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>
description
</code>
</td>
<td>
<code>
TEXT
</code>
</td>
</tr>
<tr>
<td>
<code>
condition
</code>
</td>
<td>
<code>
TAG
</code>
</td>
</tr>
<tr>
<td>
<code>
price
</code>
</td>
<td>
<code>
NUMERIC
</code>
</td>
</tr>
</tbody>
</table>
<p>
You can find more details about creating the index and loading the demo data in the
<a href="/docs/latest/develop/get-started/document-database/">
quick start guide
</a>
.
</p>
<h2 id="numeric-field">
Numeric field
</h2>
<p>
To perform an exact match query on a numeric field, you need to construct a range query with the same start and end value:
</p>
<pre tabindex="0"><code>FT.SEARCH index "@field:[value value]"
or
FT.SEARCH index "@field:[value]" DIALECT 2 # requires v2.10
or
FT.SEARCH index "@field==value" DIALECT 2 # requires v2.10
</code></pre>
<p>
As described in the
<a href="/docs/latest/develop/interact/search-and-query/query/range/">
article about range queries
</a>
, you can also use the
<code>
FILTER
</code>
argument:
</p>
<pre tabindex="0"><code>FT.SEARCH index "*" FILTER field start end
</code></pre>
<p>
The following examples show you how to query for bicycles with a price of exactly 270 USD:
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="query_em-stepem1">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_em-stepem1" name="query_em-stepem1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_query_em-stepem1" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-query_em-stepem1" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_em-stepem1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> FT.SEARCH idx:bicycle "@price:[270 270]"
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "bicycle:0"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl">> FT.SEARCH idx:bicycle "@price:[270]" # requires v2.10
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "bicycle:0"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl">> FT.SEARCH idx:bicycle "@price==270" # requires v2.10
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "bicycle:0"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl">> FT.SEARCH idx:bicycle "*" FILTER price 270 270
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "bicycle:0"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 2) "{\"pickup_zone\":\"POLYGON((-74.0610 40.7578, ...</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_em-stepem1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_query_em-stepem1" name="query_em-stepem1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_query_em-stepem1" title="Open example">
Python
</label>
<div aria-labelledby="tab-query_em-stepem1" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_query_em-stepem1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.json.path</span> <span class="kn">import</span> <span class="n">Path</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.field</span> <span class="kn">import</span> <span class="n">TextField</span><span class="p">,</span> <span class="n">NumericField</span><span class="p">,</span> <span class="n">TagField</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.indexDefinition</span> <span class="kn">import</span> <span class="n">IndexDefinition</span><span class="p">,</span> <span class="n">IndexType</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.query</span> <span class="kn">import</span> <span class="n">NumericFilter</span><span class="p">,</span> <span class="n">Query</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># create index</span>
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="p">(</span><span class="s2">"$.description"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"description"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="p">(</span><span class="s2">"$.price"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"price"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.condition"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"condition"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:bicycle"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"bicycle:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># load data</span>
</span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_em.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">pipeline</span><span class="p">(</span><span class="n">transaction</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">bid</span><span class="p">,</span> <span class="n">bicycle</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">bicycles</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">pipeline</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s1">'bicycle:</span><span class="si">{</span><span class="n">bid</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="n">bicycle</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270 270]"</span><span class="p">))</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270]"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line hl"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price==270"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line hl"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="n">Query</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s2">"price"</span><span class="p">,</span> <span class="mi">270</span><span class="p">,</span> <span class="mi">270</span><span class="p">))</span>
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@condition:</span><span class="si">{new}</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 5</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.email"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"key:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="s1">'{"email": "[email protected]"}'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">idx_email</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"[email protected]"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@description:</span><span class="se">\"</span><span class="s2">rough terrain</span><span class="se">\"</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_query_em-stepem1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_query_em-stepem1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/query_em.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_query_em-stepem1" name="query_em-stepem1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_query_em-stepem1" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-query_em-stepem1" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_em-stepem1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'node:assert'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span><span class="p">,</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">AggregateGroupByReducers</span><span class="p">,</span> <span class="nx">AggregateSteps</span><span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// create index
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.price'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">NUMERIC</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'price'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.condition'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'condition'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// load data
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_em.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="nx">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270 270]'</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="kr">const</span> <span class="nx">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270]'</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="kr">const</span> <span class="nx">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price==270'</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="c1">// FILTER is not supported
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// const res4 = await client.ft.search('idx:bicycle', '*', {
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// FILTER: {
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// field: 'price',
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// min: 270,
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// max: 270,
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// }
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// });
</span></span></span><span class="line hl"><span class="cl"><span class="c1">// console.log(res4.total); // >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@condition:{new}'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res5</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.email'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'email'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'key:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">email</span><span class="o">:</span> <span class="s1">'[email protected]'</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="s1">'[email protected]'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res6</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@description:"rough terrain"'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res7</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_query_em-stepem1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_query_em-stepem1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/query-em.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_query_em-stepem1" name="query_em-stepem1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_query_em-stepem1" title="Open example">
Java
</label>
<div aria-labelledby="tab-query_em-stepem1" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_query_em-stepem1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.stream.Stream</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.json.Path2</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.schemafields.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.exceptions.JedisDataException</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">QueryEmExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">schema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.brand"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"brand"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.model"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"model"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.description"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"description"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.price"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"price"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.condition"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"condition"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span><span class="o">.</span><span class="na">createParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"bicycle:"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">String</span><span class="o">[]</span> <span class="n">bicycleJsons</span> <span class="o">=</span> <span class="k">new</span> <span class="n">String</span><span class="o">[]</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-74.0610 40.6678, -74.0610 40.7578))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-74.0060,40.7128\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Velorim\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Jigger\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 270,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Small and powerful, the Jigger is the best ride for the smallest of tikes! "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"This is the tiniest kids’ pedal bike on the market available without a coaster brake, the Jigger "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"is the vehicle of choice for the rare tenacious little rider raring to go.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-118.2887 34.0972, -118.1987 34.0972, -118.1987 33.9872, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-118.2887 33.9872, -118.2887 34.0972))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-118.2437,34.0522\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Bicyk\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Hillcraft\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Kids want to ride with as little weight as possible. Especially "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on an incline! They may be at the age when a 27.5'' wheel bike is just too clumsy coming "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"off a 24'' bike. The Hillcraft 26 is just the solution they need!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-87.6848 41.8231, -87.6848 41.9331))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-87.6298,41.8781\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Nord\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Chook air 5\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The Chook Air 5 gives kids aged six years and older a durable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and uberlight mountain bike for their first experience on tracks and easy cruising through "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"forests and fields. The lower top tube makes it easy to mount and dismount in any "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"situation, giving your kids greater safety on the trails.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-80.2433 25.8067, -80.1333 25.8067, -80.1333 25.6967, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-80.2433 25.6967, -80.2433 25.8067))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-80.1918,25.7617\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Eva\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Eva 291\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3400,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The sister company to Nord, Eva launched in 2005 as the first "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and only women-dedicated bicycle brand. Designed by women for women, allEva bikes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"are optimized for the feminine physique using analytics from a body metrics database. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"If you like 29ers, try the Eva 291. It’s a brand new bike for 2022.. This "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"full-suspension, cross-country ride has been designed for velocity. The 291 has "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"100mm of front and rear travel, a superlight aluminum frame and fast-rolling "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"29-inch wheels. Yippee!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-122.4644 37.8199, -122.3544 37.8199, -122.3544 37.7099, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-122.4644 37.7099, -122.4644 37.8199))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-122.4194,37.7749\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Noka Bikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Kahuna\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Whether you want to try your hand at XC racing or are looking "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"for a lively trail bike that's just as inspiring on the climbs as it is over rougher "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ground, the Wilder is one heck of a bike built specifically for short women. Both the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"frames and components have been tweaked to include a women’s saddle, different bars "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and unique colourway.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-0.1778 51.4024, -0.1778 51.5524))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-0.1278,51.5074\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Breakout\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"XBN 2.1 Alloy\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 810,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The XBN 2.1 Alloy is our entry-level road bike – but that’s "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"not to say that it’s a basic machine. With an internal weld aluminium frame, a full "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"carbon fork, and the slick-shifting Claris gears from Shimano’s, this is a bike which "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"doesn’t break the bank and delivers craved performance.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"2.1767 48.5516, 2.1767 48.9016))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.3522,48.8566\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"ScramBikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"WattBike\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 2300,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The WattBike is the best e-bike for people who still "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"charge. It’s great for tackling hilly terrain or if you just fancy a more "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"leisurely ride. With three working modes, you can choose between E-bike, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"assisted bicycle, and normal bike modes.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"13.3260 52.2700, 13.3260 52.5700))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"13.4050,52.5200\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Peaknetic\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Secto\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 430,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"If you struggle with stiff fingers or a kinked neck or "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"back after a few minutes on the road, this lightweight, aluminum bike alleviates "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"those issues and allows you to enjoy the ride. From the ergonomic grips to the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The rear-inclined seat tube facilitates stability by allowing you to put a foot "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on the ground to balance at a stop, and the low step-over frame makes it "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"accessible for all ability and mobility levels. The saddle is very soft, with "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"a wide back to support your hip joints and a cutout in the center to redistribute "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"that pressure. Rim brakes deliver satisfactory braking control, and the wide tires "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"facilitate setting up the Roll Low-Entry as your preferred commuter, and the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"1.9450 41.1987, 1.9450 41.4301))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.1734, 41.3851\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"nHill\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Summit\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"This budget mountain bike from nHill performs well both "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on bike paths and on the trail. The fork with 100mm of travel absorbs rough "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The Shimano Tourney drivetrain offered enough gears for finding a comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Whether you want an affordable bike that you can take to work, but also take "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"trail in mountains on the weekends or you’re just after a stable, comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ride for the bike path, the Summit gives a good value for money.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((12.4464 42.1028, 12.5464 42.1028, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"12.4964,41.9028\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"ThrillCycle\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"BikeShind\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"An artsy, retro-inspired bicycle that’s as "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn’t "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"suggest taking it to the mountains. Fenders protect you from mud, and a rear "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"basket lets you transport groceries, flowers and books. The ThrillCycle comes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"with a limited lifetime warranty, so this little guy will last you long "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"past graduation.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"refurbished\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">bicycleJsons</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"bicycle:"</span> <span class="o">+</span> <span class="n">i</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="n">bicycleJsons</span><span class="o">[</span><span class="n">i</span><span class="o">]);</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@price:[270 270]"</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res1</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs1</span> <span class="o">=</span> <span class="n">res1</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs1</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs1</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"*"</span><span class="o">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">FTSearchParams</span><span class="o">.</span><span class="na">searchParams</span><span class="o">()</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="mi">270</span><span class="o">,</span> <span class="mi">270</span><span class="o">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res2</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs2</span> <span class="o">=</span> <span class="n">res2</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs2</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs2</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@condition:{new}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res3</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs3</span> <span class="o">=</span> <span class="n">res3</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs3</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs3</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:6
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:7
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">emailSchema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.email"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"email"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"key:"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">emailSchema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"key:1"</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">RediSearchUtil</span><span class="o">.</span><span class="na">escapeQuery</span><span class="o">(</span><span class="s">"@email{[email protected]}"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTSearchParams</span><span class="o">().</span><span class="na">dialect</span><span class="o">(</span><span class="mi">2</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res4</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"@description:\"rough terrain\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res5</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs5</span> <span class="o">=</span> <span class="n">res5</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs5</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs5</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_query_em-stepem1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_query_em-stepem1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/QueryEmExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_query_em-stepem1" name="query_em-stepem1" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_query_em-stepem1" title="Open example">
C#
</label>
<div aria-labelledby="tab-query_em-stepem1" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_query_em-stepem1" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.RedisStackCommands</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search.Literals.Enums</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">QueryEmExample</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">idxParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"bicycle:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">bikeSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTextField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.description"</span><span class="p">,</span> <span class="s">"description"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddNumericField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.price"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.condition"</span><span class="p">,</span> <span class="s">"condition"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:bicycle"</span><span class="p">,</span> <span class="n">idxParams</span><span class="p">,</span> <span class="n">bikeSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bicycles</span> <span class="p">=</span> <span class="k">new</span> <span class="kt">object</span><span class="p">[]</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Velorim"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Jigger"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">270</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Small and powerful, the Jigger is the best ride "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"for the smallest of tikes! This is the tiniest "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"kids’ pedal bike on the market available without"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a coaster brake, the Jigger is the vehicle of "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"choice for the rare tenacious little rider "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"raring to go."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Bicyk"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Hillcraft"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Kids want to ride with as little weight as possible."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Especially on an incline! They may be at the age "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"when a 27.5 inch wheel bike is just too clumsy coming "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"off a 24 inch bike. The Hillcraft 26 is just the solution"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" they need!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Nord"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Chook air 5"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The Chook Air 5 gives kids aged six years and older "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"a durable and uberlight mountain bike for their first"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" experience on tracks and easy cruising through forests"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and fields. The lower top tube makes it easy to mount"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and dismount in any situation, giving your kids greater"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" safety on the trails."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Eva"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Eva 291"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3400</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The sister company to Nord, Eva launched in 2005 as the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" first and only women-dedicated bicycle brand. Designed"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" by women for women, allEva bikes are optimized for the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" feminine physique using analytics from a body metrics"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" database. If you like 29ers, try the Eva 291. It’s a "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"brand new bike for 2022.. This full-suspension, "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"cross-country ride has been designed for velocity. The"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 291 has 100mm of front and rear travel, a superlight "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"aluminum frame and fast-rolling 29-inch wheels. Yippee!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Noka Bikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Kahuna"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Whether you want to try your hand at XC racing or are "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"looking for a lively trail bike that's just as inspiring"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" on the climbs as it is over rougher ground, the Wilder"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" is one heck of a bike built specifically for short women."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Both the frames and components have been tweaked to "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"include a women’s saddle, different bars and unique "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"colourway."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Breakout"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"XBN 2.1 Alloy"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">810</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The XBN 2.1 Alloy is our entry-level road bike – but that’s"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" not to say that it’s a basic machine. With an internal "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"weld aluminium frame, a full carbon fork, and the slick-shifting"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Claris gears from Shimano’s, this is a bike which doesn’t"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" break the bank and delivers craved performance."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"ScramBikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"WattBike"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">2300</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The WattBike is the best e-bike for people who still feel young"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" at heart. It has a Bafang 1000W mid-drive system and a 48V"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 17.5AH Samsung Lithium-Ion battery, allowing you to ride for"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" more than 60 miles on one charge. It’s great for tackling hilly"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" terrain or if you just fancy a more leisurely ride. With three"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" working modes, you can choose between E-bike, assisted bicycle,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and normal bike modes."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Peaknetic"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Secto"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">430</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"If you struggle with stiff fingers or a kinked neck or back after"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a few minutes on the road, this lightweight, aluminum bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" alleviates those issues and allows you to enjoy the ride. From"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" the ergonomic grips to the lumbar-supporting seat position, the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Roll Low-Entry offers incredible comfort. The rear-inclined seat"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" tube facilitates stability by allowing you to put a foot on the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" ground to balance at a stop, and the low step-over frame makes it"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" accessible for all ability and mobility levels. The saddle is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" very soft, with a wide back to support your hip joints and a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" cutout in the center to redistribute that pressure. Rim brakes"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" deliver satisfactory braking control, and the wide tires provide"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a smooth, stable ride on paved roads and gravel. Rack and fender"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mounts facilitate setting up the Roll Low-Entry as your preferred"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" commuter, and the BMX-like handlebar offers space for mounting a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flashlight, bell, or phone holder."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"nHill"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Summit"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"This budget mountain bike from nHill performs well both on bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" paths and on the trail. The fork with 100mm of travel absorbs"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" rough terrain. Fat Kenda Booster tires give you grip in corners"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and on wet trails. The Shimano Tourney drivetrain offered enough"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" gears for finding a comfortable pace to ride uphill, and the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Tektro hydraulic disc brakes break smoothly. Whether you want an"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" affordable bike that you can take to work, but also take trail in"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mountains on the weekends or you’re just after a stable,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" comfortable ride for the bike path, the Summit gives a good value"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" for money."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"ThrillCycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"BikeShind"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"An artsy, retro-inspired bicycle that’s as functional as it is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" pretty: The ThrillCycle steel frame offers a smooth ride. A"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 9-speed drivetrain has enough gears for coasting in the city, but"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" we wouldn’t suggest taking it to the mountains. Fenders protect"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" you from mud, and a rear basket lets you transport groceries,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flowers and books. The ThrillCycle comes with a limited lifetime"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" warranty, so this little guy will last you long past graduation."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"refurbished"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="p">(</span><span class="kt">var</span> <span class="n">i</span> <span class="p">=</span> <span class="m">0</span><span class="p">;</span> <span class="n">i</span> <span class="p"><</span> <span class="n">bicycles</span><span class="p">.</span><span class="n">Length</span><span class="p">;</span> <span class="n">i</span><span class="p">++)</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">$"bicycle:{i}"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="n">bicycles</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@price:[270 270]"</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res1</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">().</span><span class="n">AddFilter</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">.</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">270</span><span class="p">,</span> <span class="m">270</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res2</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@condition:{new}"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res3</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 4</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">emailSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.email"</span><span class="p">,</span> <span class="s">"email"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">emailParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"key:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:email"</span><span class="p">,</span> <span class="n">emailParams</span><span class="p">,</span> <span class="n">emailSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">"key:1"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:email"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@email:{test\\@redis\\.com}"</span><span class="p">).</span><span class="n">Dialect</span><span class="p">(</span><span class="m">2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res4</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@description:\"rough terrain\""</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res5</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_query_em-stepem1')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_query_em-stepem1" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/QueryEmExample.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<h2 id="tag-field">
Tag field
</h2>
<p>
A tag is a short sequence of text, for example, "new" or "Los Angeles".
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Important:
</div>
If you need to query for short texts, use a tag query instead of a full-text query. Tag fields are more space-efficient for storing index entries and often lead to lower query complexity for exact match queries.
</div>
</div>
<p>
You can construct a tag query for a single tag in the following way:
</p>
<pre tabindex="0"><code>FT.SEARCH index "@field:{tag}"
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The curly brackets are mandatory for tag queries.
</div>
</div>
<p>
This short example shows you how to query for new bicycles:
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="query_em-stepem2">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_em-stepem2" name="query_em-stepem2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_query_em-stepem2" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-query_em-stepem2" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_em-stepem2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> FT.SEARCH idx:bicycle "@condition:{new}"
</span></span><span class="line hl"><span class="cl"> 1) (integer) 5
</span></span><span class="line hl"><span class="cl"> 2) "bicycle:0"
</span></span><span class="line hl"><span class="cl"> 3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"
</span></span><span class="line hl"><span class="cl"> 4) "bicycle:5"
</span></span><span class="line hl"><span class="cl"> 5) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"
</span></span><span class="line hl"><span class="cl"> 6) "bicycle:6"
</span></span><span class="line hl"><span class="cl"> 7) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"
</span></span><span class="line hl"><span class="cl"> 8) "bicycle:7"
</span></span><span class="line hl"><span class="cl"> 9) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"
</span></span><span class="line hl"><span class="cl">10) "bicycle:8"
</span></span><span class="line hl"><span class="cl">11) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_em-stepem2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_query_em-stepem2" name="query_em-stepem2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_query_em-stepem2" title="Open example">
Python
</label>
<div aria-labelledby="tab-query_em-stepem2" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_query_em-stepem2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.json.path</span> <span class="kn">import</span> <span class="n">Path</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.field</span> <span class="kn">import</span> <span class="n">TextField</span><span class="p">,</span> <span class="n">NumericField</span><span class="p">,</span> <span class="n">TagField</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.indexDefinition</span> <span class="kn">import</span> <span class="n">IndexDefinition</span><span class="p">,</span> <span class="n">IndexType</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.query</span> <span class="kn">import</span> <span class="n">NumericFilter</span><span class="p">,</span> <span class="n">Query</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># create index</span>
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="p">(</span><span class="s2">"$.description"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"description"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="p">(</span><span class="s2">"$.price"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"price"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.condition"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"condition"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:bicycle"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"bicycle:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># load data</span>
</span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_em.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">pipeline</span><span class="p">(</span><span class="n">transaction</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">bid</span><span class="p">,</span> <span class="n">bicycle</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">bicycles</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">pipeline</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s1">'bicycle:</span><span class="si">{</span><span class="n">bid</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="n">bicycle</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270 270]"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270]"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price==270"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="n">Query</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s2">"price"</span><span class="p">,</span> <span class="mi">270</span><span class="p">,</span> <span class="mi">270</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@condition:</span><span class="si">{new}</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> 5</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.email"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"key:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="s1">'{"email": "[email protected]"}'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">idx_email</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"[email protected]"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@description:</span><span class="se">\"</span><span class="s2">rough terrain</span><span class="se">\"</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_query_em-stepem2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_query_em-stepem2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/query_em.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_query_em-stepem2" name="query_em-stepem2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_query_em-stepem2" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-query_em-stepem2" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_em-stepem2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'node:assert'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span><span class="p">,</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">AggregateGroupByReducers</span><span class="p">,</span> <span class="nx">AggregateSteps</span><span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// create index
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.price'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">NUMERIC</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'price'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.condition'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'condition'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// load data
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_em.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="nx">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270 270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price==270'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// FILTER is not supported
</span></span></span><span class="line"><span class="cl"><span class="c1">// const res4 = await client.ft.search('idx:bicycle', '*', {
</span></span></span><span class="line"><span class="cl"><span class="c1">// FILTER: {
</span></span></span><span class="line"><span class="cl"><span class="c1">// field: 'price',
</span></span></span><span class="line"><span class="cl"><span class="c1">// min: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// max: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// }
</span></span></span><span class="line"><span class="cl"><span class="c1">// });
</span></span></span><span class="line"><span class="cl"><span class="c1">// console.log(res4.total); // >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@condition:{new}'</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res5</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.email'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'email'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'key:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">email</span><span class="o">:</span> <span class="s1">'[email protected]'</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="s1">'[email protected]'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res6</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@description:"rough terrain"'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res7</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_query_em-stepem2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_query_em-stepem2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/query-em.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_query_em-stepem2" name="query_em-stepem2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_query_em-stepem2" title="Open example">
Java
</label>
<div aria-labelledby="tab-query_em-stepem2" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_query_em-stepem2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.stream.Stream</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.json.Path2</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.schemafields.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.exceptions.JedisDataException</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">QueryEmExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">schema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.brand"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"brand"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.model"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"model"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.description"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"description"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.price"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"price"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.condition"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"condition"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span><span class="o">.</span><span class="na">createParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"bicycle:"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">String</span><span class="o">[]</span> <span class="n">bicycleJsons</span> <span class="o">=</span> <span class="k">new</span> <span class="n">String</span><span class="o">[]</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-74.0610 40.6678, -74.0610 40.7578))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-74.0060,40.7128\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Velorim\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Jigger\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 270,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Small and powerful, the Jigger is the best ride for the smallest of tikes! "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"This is the tiniest kids’ pedal bike on the market available without a coaster brake, the Jigger "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"is the vehicle of choice for the rare tenacious little rider raring to go.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-118.2887 34.0972, -118.1987 34.0972, -118.1987 33.9872, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-118.2887 33.9872, -118.2887 34.0972))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-118.2437,34.0522\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Bicyk\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Hillcraft\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Kids want to ride with as little weight as possible. Especially "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on an incline! They may be at the age when a 27.5'' wheel bike is just too clumsy coming "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"off a 24'' bike. The Hillcraft 26 is just the solution they need!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-87.6848 41.8231, -87.6848 41.9331))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-87.6298,41.8781\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Nord\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Chook air 5\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The Chook Air 5 gives kids aged six years and older a durable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and uberlight mountain bike for their first experience on tracks and easy cruising through "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"forests and fields. The lower top tube makes it easy to mount and dismount in any "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"situation, giving your kids greater safety on the trails.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-80.2433 25.8067, -80.1333 25.8067, -80.1333 25.6967, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-80.2433 25.6967, -80.2433 25.8067))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-80.1918,25.7617\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Eva\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Eva 291\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3400,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The sister company to Nord, Eva launched in 2005 as the first "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and only women-dedicated bicycle brand. Designed by women for women, allEva bikes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"are optimized for the feminine physique using analytics from a body metrics database. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"If you like 29ers, try the Eva 291. It’s a brand new bike for 2022.. This "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"full-suspension, cross-country ride has been designed for velocity. The 291 has "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"100mm of front and rear travel, a superlight aluminum frame and fast-rolling "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"29-inch wheels. Yippee!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-122.4644 37.8199, -122.3544 37.8199, -122.3544 37.7099, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-122.4644 37.7099, -122.4644 37.8199))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-122.4194,37.7749\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Noka Bikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Kahuna\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Whether you want to try your hand at XC racing or are looking "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"for a lively trail bike that's just as inspiring on the climbs as it is over rougher "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ground, the Wilder is one heck of a bike built specifically for short women. Both the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"frames and components have been tweaked to include a women’s saddle, different bars "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and unique colourway.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-0.1778 51.4024, -0.1778 51.5524))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-0.1278,51.5074\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Breakout\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"XBN 2.1 Alloy\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 810,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The XBN 2.1 Alloy is our entry-level road bike – but that’s "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"not to say that it’s a basic machine. With an internal weld aluminium frame, a full "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"carbon fork, and the slick-shifting Claris gears from Shimano’s, this is a bike which "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"doesn’t break the bank and delivers craved performance.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"2.1767 48.5516, 2.1767 48.9016))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.3522,48.8566\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"ScramBikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"WattBike\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 2300,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The WattBike is the best e-bike for people who still "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"charge. It’s great for tackling hilly terrain or if you just fancy a more "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"leisurely ride. With three working modes, you can choose between E-bike, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"assisted bicycle, and normal bike modes.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"13.3260 52.2700, 13.3260 52.5700))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"13.4050,52.5200\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Peaknetic\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Secto\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 430,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"If you struggle with stiff fingers or a kinked neck or "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"back after a few minutes on the road, this lightweight, aluminum bike alleviates "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"those issues and allows you to enjoy the ride. From the ergonomic grips to the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The rear-inclined seat tube facilitates stability by allowing you to put a foot "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on the ground to balance at a stop, and the low step-over frame makes it "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"accessible for all ability and mobility levels. The saddle is very soft, with "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"a wide back to support your hip joints and a cutout in the center to redistribute "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"that pressure. Rim brakes deliver satisfactory braking control, and the wide tires "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"facilitate setting up the Roll Low-Entry as your preferred commuter, and the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"1.9450 41.1987, 1.9450 41.4301))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.1734, 41.3851\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"nHill\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Summit\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"This budget mountain bike from nHill performs well both "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on bike paths and on the trail. The fork with 100mm of travel absorbs rough "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The Shimano Tourney drivetrain offered enough gears for finding a comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Whether you want an affordable bike that you can take to work, but also take "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"trail in mountains on the weekends or you’re just after a stable, comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ride for the bike path, the Summit gives a good value for money.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((12.4464 42.1028, 12.5464 42.1028, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"12.4964,41.9028\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"ThrillCycle\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"BikeShind\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"An artsy, retro-inspired bicycle that’s as "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn’t "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"suggest taking it to the mountains. Fenders protect you from mud, and a rear "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"basket lets you transport groceries, flowers and books. The ThrillCycle comes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"with a limited lifetime warranty, so this little guy will last you long "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"past graduation.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"refurbished\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">bicycleJsons</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"bicycle:"</span> <span class="o">+</span> <span class="n">i</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="n">bicycleJsons</span><span class="o">[</span><span class="n">i</span><span class="o">]);</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@price:[270 270]"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res1</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs1</span> <span class="o">=</span> <span class="n">res1</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs1</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs1</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"*"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTSearchParams</span><span class="o">.</span><span class="na">searchParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="mi">270</span><span class="o">,</span> <span class="mi">270</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res2</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs2</span> <span class="o">=</span> <span class="n">res2</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs2</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs2</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@condition:{new}"</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res3</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 5
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs3</span> <span class="o">=</span> <span class="n">res3</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs3</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs3</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> bicycle:5
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:6
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:7
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">emailSchema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.email"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"email"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"key:"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">emailSchema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"key:1"</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">RediSearchUtil</span><span class="o">.</span><span class="na">escapeQuery</span><span class="o">(</span><span class="s">"@email{[email protected]}"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTSearchParams</span><span class="o">().</span><span class="na">dialect</span><span class="o">(</span><span class="mi">2</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res4</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"@description:\"rough terrain\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res5</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs5</span> <span class="o">=</span> <span class="n">res5</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs5</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs5</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_query_em-stepem2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_query_em-stepem2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/QueryEmExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_query_em-stepem2" name="query_em-stepem2" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_query_em-stepem2" title="Open example">
C#
</label>
<div aria-labelledby="tab-query_em-stepem2" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_query_em-stepem2" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.RedisStackCommands</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search.Literals.Enums</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">QueryEmExample</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">idxParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"bicycle:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">bikeSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTextField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.description"</span><span class="p">,</span> <span class="s">"description"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddNumericField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.price"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.condition"</span><span class="p">,</span> <span class="s">"condition"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:bicycle"</span><span class="p">,</span> <span class="n">idxParams</span><span class="p">,</span> <span class="n">bikeSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bicycles</span> <span class="p">=</span> <span class="k">new</span> <span class="kt">object</span><span class="p">[]</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Velorim"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Jigger"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">270</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Small and powerful, the Jigger is the best ride "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"for the smallest of tikes! This is the tiniest "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"kids’ pedal bike on the market available without"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a coaster brake, the Jigger is the vehicle of "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"choice for the rare tenacious little rider "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"raring to go."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Bicyk"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Hillcraft"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Kids want to ride with as little weight as possible."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Especially on an incline! They may be at the age "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"when a 27.5 inch wheel bike is just too clumsy coming "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"off a 24 inch bike. The Hillcraft 26 is just the solution"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" they need!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Nord"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Chook air 5"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The Chook Air 5 gives kids aged six years and older "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"a durable and uberlight mountain bike for their first"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" experience on tracks and easy cruising through forests"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and fields. The lower top tube makes it easy to mount"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and dismount in any situation, giving your kids greater"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" safety on the trails."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Eva"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Eva 291"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3400</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The sister company to Nord, Eva launched in 2005 as the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" first and only women-dedicated bicycle brand. Designed"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" by women for women, allEva bikes are optimized for the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" feminine physique using analytics from a body metrics"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" database. If you like 29ers, try the Eva 291. It’s a "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"brand new bike for 2022.. This full-suspension, "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"cross-country ride has been designed for velocity. The"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 291 has 100mm of front and rear travel, a superlight "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"aluminum frame and fast-rolling 29-inch wheels. Yippee!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Noka Bikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Kahuna"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Whether you want to try your hand at XC racing or are "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"looking for a lively trail bike that's just as inspiring"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" on the climbs as it is over rougher ground, the Wilder"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" is one heck of a bike built specifically for short women."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Both the frames and components have been tweaked to "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"include a women’s saddle, different bars and unique "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"colourway."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Breakout"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"XBN 2.1 Alloy"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">810</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The XBN 2.1 Alloy is our entry-level road bike – but that’s"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" not to say that it’s a basic machine. With an internal "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"weld aluminium frame, a full carbon fork, and the slick-shifting"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Claris gears from Shimano’s, this is a bike which doesn’t"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" break the bank and delivers craved performance."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"ScramBikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"WattBike"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">2300</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The WattBike is the best e-bike for people who still feel young"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" at heart. It has a Bafang 1000W mid-drive system and a 48V"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 17.5AH Samsung Lithium-Ion battery, allowing you to ride for"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" more than 60 miles on one charge. It’s great for tackling hilly"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" terrain or if you just fancy a more leisurely ride. With three"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" working modes, you can choose between E-bike, assisted bicycle,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and normal bike modes."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Peaknetic"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Secto"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">430</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"If you struggle with stiff fingers or a kinked neck or back after"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a few minutes on the road, this lightweight, aluminum bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" alleviates those issues and allows you to enjoy the ride. From"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" the ergonomic grips to the lumbar-supporting seat position, the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Roll Low-Entry offers incredible comfort. The rear-inclined seat"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" tube facilitates stability by allowing you to put a foot on the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" ground to balance at a stop, and the low step-over frame makes it"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" accessible for all ability and mobility levels. The saddle is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" very soft, with a wide back to support your hip joints and a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" cutout in the center to redistribute that pressure. Rim brakes"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" deliver satisfactory braking control, and the wide tires provide"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a smooth, stable ride on paved roads and gravel. Rack and fender"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mounts facilitate setting up the Roll Low-Entry as your preferred"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" commuter, and the BMX-like handlebar offers space for mounting a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flashlight, bell, or phone holder."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"nHill"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Summit"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"This budget mountain bike from nHill performs well both on bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" paths and on the trail. The fork with 100mm of travel absorbs"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" rough terrain. Fat Kenda Booster tires give you grip in corners"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and on wet trails. The Shimano Tourney drivetrain offered enough"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" gears for finding a comfortable pace to ride uphill, and the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Tektro hydraulic disc brakes break smoothly. Whether you want an"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" affordable bike that you can take to work, but also take trail in"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mountains on the weekends or you’re just after a stable,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" comfortable ride for the bike path, the Summit gives a good value"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" for money."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"ThrillCycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"BikeShind"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"An artsy, retro-inspired bicycle that’s as functional as it is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" pretty: The ThrillCycle steel frame offers a smooth ride. A"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 9-speed drivetrain has enough gears for coasting in the city, but"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" we wouldn’t suggest taking it to the mountains. Fenders protect"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" you from mud, and a rear basket lets you transport groceries,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flowers and books. The ThrillCycle comes with a limited lifetime"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" warranty, so this little guy will last you long past graduation."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"refurbished"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="p">(</span><span class="kt">var</span> <span class="n">i</span> <span class="p">=</span> <span class="m">0</span><span class="p">;</span> <span class="n">i</span> <span class="p"><</span> <span class="n">bicycles</span><span class="p">.</span><span class="n">Length</span><span class="p">;</span> <span class="n">i</span><span class="p">++)</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">$"bicycle:{i}"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="n">bicycles</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@price:[270 270]"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res1</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">().</span><span class="n">AddFilter</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">.</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">270</span><span class="p">,</span> <span class="m">270</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res2</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@condition:{new}"</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res3</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 4</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">emailSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.email"</span><span class="p">,</span> <span class="s">"email"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">emailParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"key:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:email"</span><span class="p">,</span> <span class="n">emailParams</span><span class="p">,</span> <span class="n">emailSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">"key:1"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:email"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@email:{test\\@redis\\.com}"</span><span class="p">).</span><span class="n">Dialect</span><span class="p">(</span><span class="m">2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res4</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@description:\"rough terrain\""</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res5</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_query_em-stepem2')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_query_em-stepem2" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/QueryEmExample.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<p>
Use double quotes and
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/dialects/#dialect-2">
DIALECT 2
</a>
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:
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="query_em-stepem3">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_em-stepem3" name="query_em-stepem3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_query_em-stepem3" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-query_em-stepem3" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_em-stepem3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">> FT.CREATE idx:email ON JSON PREFIX 1 key: SCHEMA $.email AS email TAG
</span></span><span class="line hl"><span class="cl">OK
</span></span><span class="line hl"><span class="cl">> JSON.SET key:1 $ '{"email": "[email protected]"}'
</span></span><span class="line hl"><span class="cl">OK
</span></span><span class="line hl"><span class="cl">> FT.SEARCH idx:email '@email:{"[email protected]"}' DIALECT 2
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "key:1"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 2) "{\"email\":\"[email protected]\"}"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_em-stepem3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_query_em-stepem3" name="query_em-stepem3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_query_em-stepem3" title="Open example">
Python
</label>
<div aria-labelledby="tab-query_em-stepem3" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_query_em-stepem3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.json.path</span> <span class="kn">import</span> <span class="n">Path</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.field</span> <span class="kn">import</span> <span class="n">TextField</span><span class="p">,</span> <span class="n">NumericField</span><span class="p">,</span> <span class="n">TagField</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.indexDefinition</span> <span class="kn">import</span> <span class="n">IndexDefinition</span><span class="p">,</span> <span class="n">IndexType</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.query</span> <span class="kn">import</span> <span class="n">NumericFilter</span><span class="p">,</span> <span class="n">Query</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># create index</span>
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="p">(</span><span class="s2">"$.description"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"description"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="p">(</span><span class="s2">"$.price"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"price"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.condition"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"condition"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:bicycle"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"bicycle:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># load data</span>
</span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_em.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">pipeline</span><span class="p">(</span><span class="n">transaction</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">bid</span><span class="p">,</span> <span class="n">bicycle</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">bicycles</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">pipeline</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s1">'bicycle:</span><span class="si">{</span><span class="n">bid</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="n">bicycle</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270 270]"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270]"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price==270"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="n">Query</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s2">"price"</span><span class="p">,</span> <span class="mi">270</span><span class="p">,</span> <span class="mi">270</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@condition:</span><span class="si">{new}</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 5</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.email"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"email"</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="p">)</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">idx_email</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:email"</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="n">idx_email</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"key:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line hl"><span class="cl"><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="s1">'{"email": "[email protected]"}'</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">idx_email</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"[email protected]"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line hl"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@description:</span><span class="se">\"</span><span class="s2">rough terrain</span><span class="se">\"</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_query_em-stepem3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_query_em-stepem3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/query_em.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_query_em-stepem3" name="query_em-stepem3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_query_em-stepem3" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-query_em-stepem3" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_em-stepem3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'node:assert'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span><span class="p">,</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">AggregateGroupByReducers</span><span class="p">,</span> <span class="nx">AggregateSteps</span><span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// create index
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.price'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">NUMERIC</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'price'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.condition'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'condition'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// load data
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_em.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="nx">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270 270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price==270'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// FILTER is not supported
</span></span></span><span class="line"><span class="cl"><span class="c1">// const res4 = await client.ft.search('idx:bicycle', '*', {
</span></span></span><span class="line"><span class="cl"><span class="c1">// FILTER: {
</span></span></span><span class="line"><span class="cl"><span class="c1">// field: 'price',
</span></span></span><span class="line"><span class="cl"><span class="c1">// min: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// max: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// }
</span></span></span><span class="line"><span class="cl"><span class="c1">// });
</span></span></span><span class="line"><span class="cl"><span class="c1">// console.log(res4.total); // >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@condition:{new}'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res5</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="s1">'$.email'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'email'</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">}</span>
</span></span><span class="line hl"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'key:'</span>
</span></span><span class="line hl"><span class="cl"><span class="p">})</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">email</span><span class="o">:</span> <span class="s1">'[email protected]'</span> <span class="p">});</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="kr">const</span> <span class="nx">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="s1">'[email protected]'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</span> <span class="p">});</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res6</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@description:"rough terrain"'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res7</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_query_em-stepem3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_query_em-stepem3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/query-em.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_query_em-stepem3" name="query_em-stepem3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_query_em-stepem3" title="Open example">
Java
</label>
<div aria-labelledby="tab-query_em-stepem3" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_query_em-stepem3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.stream.Stream</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.json.Path2</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.schemafields.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.exceptions.JedisDataException</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">QueryEmExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">schema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.brand"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"brand"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.model"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"model"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.description"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"description"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.price"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"price"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.condition"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"condition"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span><span class="o">.</span><span class="na">createParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"bicycle:"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">String</span><span class="o">[]</span> <span class="n">bicycleJsons</span> <span class="o">=</span> <span class="k">new</span> <span class="n">String</span><span class="o">[]</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-74.0610 40.6678, -74.0610 40.7578))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-74.0060,40.7128\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Velorim\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Jigger\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 270,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Small and powerful, the Jigger is the best ride for the smallest of tikes! "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"This is the tiniest kids’ pedal bike on the market available without a coaster brake, the Jigger "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"is the vehicle of choice for the rare tenacious little rider raring to go.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-118.2887 34.0972, -118.1987 34.0972, -118.1987 33.9872, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-118.2887 33.9872, -118.2887 34.0972))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-118.2437,34.0522\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Bicyk\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Hillcraft\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Kids want to ride with as little weight as possible. Especially "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on an incline! They may be at the age when a 27.5'' wheel bike is just too clumsy coming "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"off a 24'' bike. The Hillcraft 26 is just the solution they need!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-87.6848 41.8231, -87.6848 41.9331))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-87.6298,41.8781\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Nord\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Chook air 5\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The Chook Air 5 gives kids aged six years and older a durable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and uberlight mountain bike for their first experience on tracks and easy cruising through "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"forests and fields. The lower top tube makes it easy to mount and dismount in any "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"situation, giving your kids greater safety on the trails.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-80.2433 25.8067, -80.1333 25.8067, -80.1333 25.6967, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-80.2433 25.6967, -80.2433 25.8067))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-80.1918,25.7617\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Eva\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Eva 291\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3400,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The sister company to Nord, Eva launched in 2005 as the first "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and only women-dedicated bicycle brand. Designed by women for women, allEva bikes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"are optimized for the feminine physique using analytics from a body metrics database. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"If you like 29ers, try the Eva 291. It’s a brand new bike for 2022.. This "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"full-suspension, cross-country ride has been designed for velocity. The 291 has "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"100mm of front and rear travel, a superlight aluminum frame and fast-rolling "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"29-inch wheels. Yippee!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-122.4644 37.8199, -122.3544 37.8199, -122.3544 37.7099, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-122.4644 37.7099, -122.4644 37.8199))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-122.4194,37.7749\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Noka Bikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Kahuna\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Whether you want to try your hand at XC racing or are looking "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"for a lively trail bike that's just as inspiring on the climbs as it is over rougher "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ground, the Wilder is one heck of a bike built specifically for short women. Both the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"frames and components have been tweaked to include a women’s saddle, different bars "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and unique colourway.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-0.1778 51.4024, -0.1778 51.5524))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-0.1278,51.5074\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Breakout\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"XBN 2.1 Alloy\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 810,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The XBN 2.1 Alloy is our entry-level road bike – but that’s "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"not to say that it’s a basic machine. With an internal weld aluminium frame, a full "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"carbon fork, and the slick-shifting Claris gears from Shimano’s, this is a bike which "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"doesn’t break the bank and delivers craved performance.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"2.1767 48.5516, 2.1767 48.9016))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.3522,48.8566\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"ScramBikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"WattBike\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 2300,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The WattBike is the best e-bike for people who still "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"charge. It’s great for tackling hilly terrain or if you just fancy a more "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"leisurely ride. With three working modes, you can choose between E-bike, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"assisted bicycle, and normal bike modes.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"13.3260 52.2700, 13.3260 52.5700))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"13.4050,52.5200\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Peaknetic\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Secto\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 430,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"If you struggle with stiff fingers or a kinked neck or "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"back after a few minutes on the road, this lightweight, aluminum bike alleviates "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"those issues and allows you to enjoy the ride. From the ergonomic grips to the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The rear-inclined seat tube facilitates stability by allowing you to put a foot "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on the ground to balance at a stop, and the low step-over frame makes it "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"accessible for all ability and mobility levels. The saddle is very soft, with "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"a wide back to support your hip joints and a cutout in the center to redistribute "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"that pressure. Rim brakes deliver satisfactory braking control, and the wide tires "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"facilitate setting up the Roll Low-Entry as your preferred commuter, and the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"1.9450 41.1987, 1.9450 41.4301))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.1734, 41.3851\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"nHill\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Summit\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"This budget mountain bike from nHill performs well both "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on bike paths and on the trail. The fork with 100mm of travel absorbs rough "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The Shimano Tourney drivetrain offered enough gears for finding a comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Whether you want an affordable bike that you can take to work, but also take "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"trail in mountains on the weekends or you’re just after a stable, comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ride for the bike path, the Summit gives a good value for money.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((12.4464 42.1028, 12.5464 42.1028, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"12.4964,41.9028\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"ThrillCycle\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"BikeShind\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"An artsy, retro-inspired bicycle that’s as "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn’t "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"suggest taking it to the mountains. Fenders protect you from mud, and a rear "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"basket lets you transport groceries, flowers and books. The ThrillCycle comes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"with a limited lifetime warranty, so this little guy will last you long "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"past graduation.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"refurbished\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">bicycleJsons</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"bicycle:"</span> <span class="o">+</span> <span class="n">i</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="n">bicycleJsons</span><span class="o">[</span><span class="n">i</span><span class="o">]);</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@price:[270 270]"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res1</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs1</span> <span class="o">=</span> <span class="n">res1</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs1</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs1</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"*"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTSearchParams</span><span class="o">.</span><span class="na">searchParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="mi">270</span><span class="o">,</span> <span class="mi">270</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res2</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs2</span> <span class="o">=</span> <span class="n">res2</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs2</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs2</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@condition:{new}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res3</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs3</span> <span class="o">=</span> <span class="n">res3</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs3</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs3</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:6
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:7
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">emailSchema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.email"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"email"</span><span class="o">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">};</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="o">()</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"key:"</span><span class="o">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">emailSchema</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"key:1"</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="o">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">RediSearchUtil</span><span class="o">.</span><span class="na">escapeQuery</span><span class="o">(</span><span class="s">"@email{[email protected]}"</span><span class="o">),</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">FTSearchParams</span><span class="o">().</span><span class="na">dialect</span><span class="o">(</span><span class="mi">2</span><span class="o">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res4</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"@description:\"rough terrain\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res5</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs5</span> <span class="o">=</span> <span class="n">res5</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs5</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs5</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_query_em-stepem3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_query_em-stepem3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/QueryEmExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_query_em-stepem3" name="query_em-stepem3" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_query_em-stepem3" title="Open example">
C#
</label>
<div aria-labelledby="tab-query_em-stepem3" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_query_em-stepem3" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.RedisStackCommands</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search.Literals.Enums</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">QueryEmExample</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">idxParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"bicycle:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">bikeSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTextField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.description"</span><span class="p">,</span> <span class="s">"description"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddNumericField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.price"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.condition"</span><span class="p">,</span> <span class="s">"condition"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:bicycle"</span><span class="p">,</span> <span class="n">idxParams</span><span class="p">,</span> <span class="n">bikeSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bicycles</span> <span class="p">=</span> <span class="k">new</span> <span class="kt">object</span><span class="p">[]</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Velorim"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Jigger"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">270</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Small and powerful, the Jigger is the best ride "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"for the smallest of tikes! This is the tiniest "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"kids’ pedal bike on the market available without"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a coaster brake, the Jigger is the vehicle of "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"choice for the rare tenacious little rider "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"raring to go."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Bicyk"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Hillcraft"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Kids want to ride with as little weight as possible."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Especially on an incline! They may be at the age "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"when a 27.5 inch wheel bike is just too clumsy coming "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"off a 24 inch bike. The Hillcraft 26 is just the solution"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" they need!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Nord"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Chook air 5"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The Chook Air 5 gives kids aged six years and older "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"a durable and uberlight mountain bike for their first"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" experience on tracks and easy cruising through forests"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and fields. The lower top tube makes it easy to mount"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and dismount in any situation, giving your kids greater"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" safety on the trails."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Eva"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Eva 291"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3400</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The sister company to Nord, Eva launched in 2005 as the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" first and only women-dedicated bicycle brand. Designed"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" by women for women, allEva bikes are optimized for the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" feminine physique using analytics from a body metrics"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" database. If you like 29ers, try the Eva 291. It’s a "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"brand new bike for 2022.. This full-suspension, "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"cross-country ride has been designed for velocity. The"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 291 has 100mm of front and rear travel, a superlight "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"aluminum frame and fast-rolling 29-inch wheels. Yippee!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Noka Bikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Kahuna"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Whether you want to try your hand at XC racing or are "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"looking for a lively trail bike that's just as inspiring"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" on the climbs as it is over rougher ground, the Wilder"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" is one heck of a bike built specifically for short women."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Both the frames and components have been tweaked to "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"include a women’s saddle, different bars and unique "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"colourway."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Breakout"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"XBN 2.1 Alloy"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">810</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The XBN 2.1 Alloy is our entry-level road bike – but that’s"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" not to say that it’s a basic machine. With an internal "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"weld aluminium frame, a full carbon fork, and the slick-shifting"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Claris gears from Shimano’s, this is a bike which doesn’t"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" break the bank and delivers craved performance."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"ScramBikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"WattBike"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">2300</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The WattBike is the best e-bike for people who still feel young"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" at heart. It has a Bafang 1000W mid-drive system and a 48V"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 17.5AH Samsung Lithium-Ion battery, allowing you to ride for"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" more than 60 miles on one charge. It’s great for tackling hilly"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" terrain or if you just fancy a more leisurely ride. With three"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" working modes, you can choose between E-bike, assisted bicycle,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and normal bike modes."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Peaknetic"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Secto"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">430</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"If you struggle with stiff fingers or a kinked neck or back after"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a few minutes on the road, this lightweight, aluminum bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" alleviates those issues and allows you to enjoy the ride. From"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" the ergonomic grips to the lumbar-supporting seat position, the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Roll Low-Entry offers incredible comfort. The rear-inclined seat"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" tube facilitates stability by allowing you to put a foot on the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" ground to balance at a stop, and the low step-over frame makes it"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" accessible for all ability and mobility levels. The saddle is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" very soft, with a wide back to support your hip joints and a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" cutout in the center to redistribute that pressure. Rim brakes"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" deliver satisfactory braking control, and the wide tires provide"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a smooth, stable ride on paved roads and gravel. Rack and fender"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mounts facilitate setting up the Roll Low-Entry as your preferred"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" commuter, and the BMX-like handlebar offers space for mounting a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flashlight, bell, or phone holder."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"nHill"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Summit"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"This budget mountain bike from nHill performs well both on bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" paths and on the trail. The fork with 100mm of travel absorbs"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" rough terrain. Fat Kenda Booster tires give you grip in corners"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and on wet trails. The Shimano Tourney drivetrain offered enough"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" gears for finding a comfortable pace to ride uphill, and the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Tektro hydraulic disc brakes break smoothly. Whether you want an"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" affordable bike that you can take to work, but also take trail in"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mountains on the weekends or you’re just after a stable,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" comfortable ride for the bike path, the Summit gives a good value"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" for money."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"ThrillCycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"BikeShind"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"An artsy, retro-inspired bicycle that’s as functional as it is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" pretty: The ThrillCycle steel frame offers a smooth ride. A"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 9-speed drivetrain has enough gears for coasting in the city, but"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" we wouldn’t suggest taking it to the mountains. Fenders protect"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" you from mud, and a rear basket lets you transport groceries,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flowers and books. The ThrillCycle comes with a limited lifetime"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" warranty, so this little guy will last you long past graduation."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"refurbished"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="p">(</span><span class="kt">var</span> <span class="n">i</span> <span class="p">=</span> <span class="m">0</span><span class="p">;</span> <span class="n">i</span> <span class="p"><</span> <span class="n">bicycles</span><span class="p">.</span><span class="n">Length</span><span class="p">;</span> <span class="n">i</span><span class="p">++)</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">$"bicycle:{i}"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="n">bicycles</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@price:[270 270]"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res1</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">().</span><span class="n">AddFilter</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">.</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">270</span><span class="p">,</span> <span class="m">270</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res2</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@condition:{new}"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res3</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 4</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">Schema</span> <span class="n">emailSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.email"</span><span class="p">,</span> <span class="s">"email"</span><span class="p">));</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">emailParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"key:"</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:email"</span><span class="p">,</span> <span class="n">emailParams</span><span class="p">,</span> <span class="n">emailSchema</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">"key:1"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"idx:email"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@email:{test\\@redis\\.com}"</span><span class="p">).</span><span class="n">Dialect</span><span class="p">(</span><span class="m">2</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res4</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@description:\"rough terrain\""</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res5</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_query_em-stepem3')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_query_em-stepem3" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/QueryEmExample.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<h2 id="full-text-field">
Full-text field
</h2>
<p>
A detailed explanation of full-text queries is available in the
<a href="/docs/latest/develop/interact/search-and-query/query/full-text/">
full-text queries documentation
</a>
. You can also query for an exact match of a phrase within a text field:
</p>
<pre tabindex="0"><code>FT.SEARCH index "@field:\"phrase\""
</code></pre>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Important:
</div>
<p>
The phrase must be wrapped by escaped double quotes for an exact match query.
</p>
<p>
You can't use a phrase that starts with a
<a href="/docs/latest/develop/interact/search-and-query/advanced-concepts/stopwords/">
stop word
</a>
.
</p>
</div>
</div>
<p>
Here is an example for finding all bicycles that have a description containing the exact text 'rough terrain':
</p>
<div class="codetabs cli group flex justify-start items-center flex-wrap box-border rounded-lg mt-0 mb-0 mx-auto bg-slate-900" id="query_em-stepem4">
<input checked="" class="radiotab w-0 h-0" data-lang="redis-cli" id="redis-cli_query_em-stepem4" name="query_em-stepem4" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="redis-cli_query_em-stepem4" title="Open example">
>_ Redis CLI
</label>
<div aria-labelledby="tab-query_em-stepem4" class="panel order-last hidden w-full mt-0 relative" id="panel_redis-cli_query_em-stepem4" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-plaintext" data-lang="plaintext"><span class="line hl"><span class="cl">FT.SEARCH idx:bicycle "@description:\"rough terrain\""
</span></span><span class="line hl"><span class="cl">1) (integer) 1
</span></span><span class="line hl"><span class="cl">2) "bicycle:8"
</span></span><span class="line hl"><span class="cl">3) 1) "$"
</span></span><span class="line hl"><span class="cl"> 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\"}"</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_redis-cli_query_em-stepem4')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<div class="flex-1 text-xs text-white overflow-ellipsis">
Are you tired of using redis-cli? Try Redis Insight - the developer GUI for Redis.
</div>
<div class="text-right">
<a class="rounded rounded-mx px-2 py-1 flex items-center text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.com/redis-enterprise/redis-insight/" tabindex="1" title="Get Redis Insight">
<svg class="w-4 h-4 mr-1" fill="none" height="14" viewbox="0 0 14 14" width="14" xmlns="http://www.w3.org/2000/svg">
<path d="M2.26236 5.66895L1.21732 6.07172L7.00018 8.65693V7.79842L2.26236 5.66895Z" fill="#fca5a5">
</path>
<path d="M2.26236 8.02271L1.21732 8.42548L7.00018 11.0119V10.1516L2.26236 8.02271Z" fill="#fca5a5">
</path>
<path d="M1.21732 3.7175L7.00018 6.30392V2.87805L8.66273 2.13423L7.00018 1.49512L1.21732 3.7175Z" fill="#fca5a5">
</path>
<path d="M7.00018 2.8781V6.30366L1.21732 3.71724V5.20004L7.00018 7.79705V8.65526L1.21732 6.07217V7.55496L7.00018 10.1553V11.0135L1.21732 8.42376V9.90656H1.18878L7.00018 12.5051L8.66273 11.7613V2.13428L7.00018 2.8781Z" fill="#f87171">
</path>
<path d="M9.07336 11.5777L10.7359 10.8338V4.01538L9.07336 4.7592V11.5777Z" fill="#f87171">
</path>
<path d="M9.07336 4.75867L10.7359 4.01485L9.07336 3.37573V4.75867Z" fill="#fca5a5">
</path>
<path d="M11.1481 10.6497L12.8112 9.90591V5.896L11.1487 6.63982L11.1481 10.6497Z" fill="#f87171">
</path>
<path d="M11.1481 6.63954L12.8112 5.89572L11.1481 5.25781V6.63954Z" fill="#fca5a5">
</path>
</svg>
<span>
Get Redis Insight
</span>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="python" id="Python_query_em-stepem4" name="query_em-stepem4" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Python_query_em-stepem4" title="Open example">
Python
</label>
<div aria-labelledby="tab-query_em-stepem4" class="panel order-last hidden w-full mt-0 relative" id="panel_Python_query_em-stepem4" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.json.path</span> <span class="kn">import</span> <span class="n">Path</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.field</span> <span class="kn">import</span> <span class="n">TextField</span><span class="p">,</span> <span class="n">NumericField</span><span class="p">,</span> <span class="n">TagField</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.indexDefinition</span> <span class="kn">import</span> <span class="n">IndexDefinition</span><span class="p">,</span> <span class="n">IndexType</span>
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redis.commands.search.query</span> <span class="kn">import</span> <span class="n">NumericFilter</span><span class="p">,</span> <span class="n">Query</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">r</span> <span class="o">=</span> <span class="n">redis</span><span class="o">.</span><span class="n">Redis</span><span class="p">(</span><span class="n">decode_responses</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># create index</span>
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="p">(</span><span class="s2">"$.description"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"description"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="p">(</span><span class="s2">"$.price"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"price"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.condition"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"condition"</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">index</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:bicycle"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">index</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"bicycle:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># load data</span>
</span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s2">"data/query_em.json"</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">bicycles</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">load</span><span class="p">(</span><span class="n">f</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">pipeline</span><span class="p">(</span><span class="n">transaction</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">bid</span><span class="p">,</span> <span class="n">bicycle</span> <span class="ow">in</span> <span class="nb">enumerate</span><span class="p">(</span><span class="n">bicycles</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">pipeline</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s1">'bicycle:</span><span class="si">{</span><span class="n">bid</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="n">bicycle</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">pipeline</span><span class="o">.</span><span class="n">execute</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270 270]"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price:[270]"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@price==270"</span><span class="p">))</span> <span class="c1"># not yet supported in redis-py</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl"> <span class="k">assert</span> <span class="n">res</span><span class="o">.</span><span class="n">total</span> <span class="o">==</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">query</span> <span class="o">=</span> <span class="n">Query</span><span class="p">(</span><span class="s2">"*"</span><span class="p">)</span><span class="o">.</span><span class="n">add_filter</span><span class="p">(</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s2">"price"</span><span class="p">,</span> <span class="mi">270</span><span class="p">,</span> <span class="mi">270</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@condition:</span><span class="si">{new}</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="c1"># >>> 5</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">schema</span> <span class="o">=</span> <span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="p">(</span><span class="s2">"$.email"</span><span class="p">,</span> <span class="n">as_name</span><span class="o">=</span><span class="s2">"email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span> <span class="o">=</span> <span class="n">r</span><span class="o">.</span><span class="n">ft</span><span class="p">(</span><span class="s2">"idx:email"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">idx_email</span><span class="o">.</span><span class="n">create_index</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">definition</span><span class="o">=</span><span class="n">IndexDefinition</span><span class="p">(</span><span class="n">prefix</span><span class="o">=</span><span class="p">[</span><span class="s2">"key:"</span><span class="p">],</span> <span class="n">index_type</span><span class="o">=</span><span class="n">IndexType</span><span class="o">.</span><span class="n">JSON</span><span class="p">),</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">r</span><span class="o">.</span><span class="n">json</span><span class="p">()</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="n">Path</span><span class="o">.</span><span class="n">root_path</span><span class="p">(),</span> <span class="s1">'{"email": "[email protected]"}'</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">res</span> <span class="o">=</span> <span class="n">idx_email</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"[email protected]"</span><span class="p">)</span><span class="o">.</span><span class="n">dialect</span><span class="p">(</span><span class="mi">2</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">except</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="n">res</span> <span class="o">=</span> <span class="n">index</span><span class="o">.</span><span class="n">search</span><span class="p">(</span><span class="n">Query</span><span class="p">(</span><span class="s2">"@description:</span><span class="se">\"</span><span class="s2">rough terrain</span><span class="se">\"</span><span class="s2">"</span><span class="p">))</span>
</span></span><span class="line hl"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">res</span><span class="o">.</span><span class="n">total</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"><span class="c1"># >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Python_query_em-stepem4')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Python_query_em-stepem4" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/python/redis-py/" tabindex="1" title="Quick-Start">
Python Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/redis-py/tree/master/doctests/query_em.py" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="javascript" id="Nodejs_query_em-stepem4" name="query_em-stepem4" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Nodejs_query_em-stepem4" title="Open example">
Node.js
</label>
<div aria-labelledby="tab-query_em-stepem4" class="panel order-last hidden w-full mt-0 relative" id="panel_Nodejs_query_em-stepem4" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-javascript" data-lang="javascript"><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">assert</span> <span class="nx">from</span> <span class="s1">'node:assert'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="nx">fs</span> <span class="nx">from</span> <span class="s1">'node:fs'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="kr">import</span> <span class="p">{</span> <span class="nx">createClient</span><span class="p">,</span> <span class="nx">SchemaFieldTypes</span><span class="p">,</span> <span class="nx">AggregateGroupByReducers</span><span class="p">,</span> <span class="nx">AggregateSteps</span><span class="p">}</span> <span class="nx">from</span> <span class="s1">'redis'</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">client</span> <span class="o">=</span> <span class="nx">createClient</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">connect</span><span class="p">().</span><span class="k">catch</span><span class="p">(</span><span class="nx">console</span><span class="p">.</span><span class="nx">error</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// create index
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.description'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TEXT</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'description'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.price'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">NUMERIC</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'price'</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.condition'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'condition'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'bicycle:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// load data
</span></span></span><span class="line"><span class="cl"><span class="c1"></span><span class="kr">const</span> <span class="nx">bicycles</span> <span class="o">=</span> <span class="nx">JSON</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">'data/query_em.json'</span><span class="p">,</span> <span class="s1">'utf8'</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nb">Promise</span><span class="p">.</span><span class="nx">all</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="nx">bicycles</span><span class="p">.</span><span class="nx">map</span><span class="p">((</span><span class="nx">bicycle</span><span class="p">,</span> <span class="nx">bid</span><span class="p">)</span> <span class="p">=></span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="sb">`bicycle:</span><span class="si">${</span><span class="nx">bid</span><span class="si">}</span><span class="sb">`</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="nx">bicycle</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="p">})</span>
</span></span><span class="line"><span class="cl"><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res1</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270 270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res1</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res2</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price:[270]'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res2</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price:[270]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res3</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@price==270'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="nx">assert</span><span class="p">.</span><span class="nx">strictEqual</span><span class="p">(</span><span class="nx">res3</span><span class="p">.</span><span class="nx">total</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'@price==270' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1">// FILTER is not supported
</span></span></span><span class="line"><span class="cl"><span class="c1">// const res4 = await client.ft.search('idx:bicycle', '*', {
</span></span></span><span class="line"><span class="cl"><span class="c1">// FILTER: {
</span></span></span><span class="line"><span class="cl"><span class="c1">// field: 'price',
</span></span></span><span class="line"><span class="cl"><span class="c1">// min: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// max: 270,
</span></span></span><span class="line"><span class="cl"><span class="c1">// }
</span></span></span><span class="line"><span class="cl"><span class="c1">// });
</span></span></span><span class="line"><span class="cl"><span class="c1">// console.log(res4.total); // >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">const</span> <span class="nx">res5</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@condition:{new}'</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res5</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">create</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="s1">'$.email'</span><span class="o">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">type</span><span class="o">:</span> <span class="nx">SchemaFieldTypes</span><span class="p">.</span><span class="nx">TAG</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">AS</span><span class="o">:</span> <span class="s1">'email'</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">},</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">ON</span><span class="o">:</span> <span class="s1">'JSON'</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nx">PREFIX</span><span class="o">:</span> <span class="s1">'key:'</span>
</span></span><span class="line"><span class="cl"><span class="p">})</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">json</span><span class="p">.</span><span class="nx">set</span><span class="p">(</span><span class="s1">'key:1'</span><span class="p">,</span> <span class="s1">'$'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">email</span><span class="o">:</span> <span class="s1">'[email protected]'</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">try</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kr">const</span> <span class="nx">res6</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:email'</span><span class="p">,</span> <span class="s1">'[email protected]'</span><span class="p">,</span> <span class="p">{</span> <span class="nx">DIALECT</span><span class="o">:</span> <span class="mi">2</span> <span class="p">});</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res6</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span> <span class="k">catch</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="s2">"'[email protected]' syntax not yet supported."</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"><span class="kr">const</span> <span class="nx">res7</span> <span class="o">=</span> <span class="kr">await</span> <span class="nx">client</span><span class="p">.</span><span class="nx">ft</span><span class="p">.</span><span class="nx">search</span><span class="p">(</span><span class="s1">'idx:bicycle'</span><span class="p">,</span> <span class="s1">'@description:"rough terrain"'</span><span class="p">);</span>
</span></span><span class="line hl"><span class="cl"><span class="nx">console</span><span class="p">.</span><span class="nx">log</span><span class="p">(</span><span class="nx">res7</span><span class="p">.</span><span class="nx">total</span><span class="p">);</span> <span class="c1">// >>> 1 (Result{1 total, docs: [Document {'id': 'bicycle:8'...)
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Nodejs_query_em-stepem4')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Nodejs_query_em-stepem4" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/nodejs/" tabindex="1" title="Quick-Start">
Node.js Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/node-redis/tree/emb-examples/doctests/query-em.js" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="java" id="Java_query_em-stepem4" name="query_em-stepem4" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Java_query_em-stepem4" title="Open example">
Java
</label>
<div aria-labelledby="tab-query_em-stepem4" class="panel order-last hidden w-full mt-0 relative" id="panel_Java_query_em-stepem4" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-java" data-lang="java"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.List</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">java.util.stream.Stream</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.UnifiedJedis</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.json.Path2</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.search.schemafields.*</span><span class="o">;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">redis.clients.jedis.exceptions.JedisDataException</span><span class="o">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">QueryEmExample</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="kd">public</span> <span class="kt">void</span> <span class="nf">run</span><span class="o">()</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">UnifiedJedis</span> <span class="n">jedis</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UnifiedJedis</span><span class="o">(</span><span class="s">"redis://localhost:6379"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">schema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.brand"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"brand"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.model"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"model"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.description"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"description"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">NumericField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.price"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"price"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">TagField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.condition"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"condition"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span><span class="o">.</span><span class="na">createParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"bicycle:"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">schema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">String</span><span class="o">[]</span> <span class="n">bicycleJsons</span> <span class="o">=</span> <span class="k">new</span> <span class="n">String</span><span class="o">[]</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-74.0610 40.7578, -73.9510 40.7578, -73.9510 40.6678, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-74.0610 40.6678, -74.0610 40.7578))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-74.0060,40.7128\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Velorim\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Jigger\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 270,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Small and powerful, the Jigger is the best ride for the smallest of tikes! "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"This is the tiniest kids’ pedal bike on the market available without a coaster brake, the Jigger "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"is the vehicle of choice for the rare tenacious little rider raring to go.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-118.2887 34.0972, -118.1987 34.0972, -118.1987 33.9872, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-118.2887 33.9872, -118.2887 34.0972))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-118.2437,34.0522\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Bicyk\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Hillcraft\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Kids want to ride with as little weight as possible. Especially "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on an incline! They may be at the age when a 27.5'' wheel bike is just too clumsy coming "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"off a 24'' bike. The Hillcraft 26 is just the solution they need!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-87.6848 41.9331, -87.5748 41.9331, -87.5748 41.8231, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-87.6848 41.8231, -87.6848 41.9331))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-87.6298,41.8781\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Nord\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Chook air 5\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The Chook Air 5 gives kids aged six years and older a durable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and uberlight mountain bike for their first experience on tracks and easy cruising through "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"forests and fields. The lower top tube makes it easy to mount and dismount in any "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"situation, giving your kids greater safety on the trails.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-80.2433 25.8067, -80.1333 25.8067, -80.1333 25.6967, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-80.2433 25.6967, -80.2433 25.8067))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-80.1918,25.7617\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Eva\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Eva 291\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3400,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The sister company to Nord, Eva launched in 2005 as the first "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and only women-dedicated bicycle brand. Designed by women for women, allEva bikes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"are optimized for the feminine physique using analytics from a body metrics database. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"If you like 29ers, try the Eva 291. It’s a brand new bike for 2022.. This "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"full-suspension, cross-country ride has been designed for velocity. The 291 has "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"100mm of front and rear travel, a superlight aluminum frame and fast-rolling "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"29-inch wheels. Yippee!\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-122.4644 37.8199, -122.3544 37.8199, -122.3544 37.7099, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-122.4644 37.7099, -122.4644 37.8199))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-122.4194,37.7749\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Noka Bikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Kahuna\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 3200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"Whether you want to try your hand at XC racing or are looking "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"for a lively trail bike that's just as inspiring on the climbs as it is over rougher "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ground, the Wilder is one heck of a bike built specifically for short women. Both the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"frames and components have been tweaked to include a women’s saddle, different bars "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"and unique colourway.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"used\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((-0.1778 51.5524, 0.0822 51.5524, 0.0822 51.4024, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"-0.1778 51.4024, -0.1778 51.5524))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"-0.1278,51.5074\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Breakout\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"XBN 2.1 Alloy\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 810,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The XBN 2.1 Alloy is our entry-level road bike – but that’s "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"not to say that it’s a basic machine. With an internal weld aluminium frame, a full "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"carbon fork, and the slick-shifting Claris gears from Shimano’s, this is a bike which "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"doesn’t break the bank and delivers craved performance.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((2.1767 48.9016, 2.5267 48.9016, 2.5267 48.5516, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"2.1767 48.5516, 2.1767 48.9016))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.3522,48.8566\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"ScramBikes\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"WattBike\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 2300,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"The WattBike is the best e-bike for people who still "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"feel young at heart. It has a Bafang 1000W mid-drive system and a 48V 17.5AH "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Samsung Lithium-Ion battery, allowing you to ride for more than 60 miles on one "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"charge. It’s great for tackling hilly terrain or if you just fancy a more "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"leisurely ride. With three working modes, you can choose between E-bike, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"assisted bicycle, and normal bike modes.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((13.3260 52.5700, 13.6550 52.5700, 13.6550 52.2700, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"13.3260 52.2700, 13.3260 52.5700))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"13.4050,52.5200\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"Peaknetic\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Secto\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 430,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"If you struggle with stiff fingers or a kinked neck or "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"back after a few minutes on the road, this lightweight, aluminum bike alleviates "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"those issues and allows you to enjoy the ride. From the ergonomic grips to the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"lumbar-supporting seat position, the Roll Low-Entry offers incredible comfort. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The rear-inclined seat tube facilitates stability by allowing you to put a foot "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on the ground to balance at a stop, and the low step-over frame makes it "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"accessible for all ability and mobility levels. The saddle is very soft, with "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"a wide back to support your hip joints and a cutout in the center to redistribute "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"that pressure. Rim brakes deliver satisfactory braking control, and the wide tires "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"provide a smooth, stable ride on paved roads and gravel. Rack and fender mounts "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"facilitate setting up the Roll Low-Entry as your preferred commuter, and the "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"BMX-like handlebar offers space for mounting a flashlight, bell, or phone holder.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((1.9450 41.4301, 2.4018 41.4301, 2.4018 41.1987, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"1.9450 41.1987, 1.9450 41.4301))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"2.1734, 41.3851\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"nHill\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"Summit\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 1200,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"This budget mountain bike from nHill performs well both "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"on bike paths and on the trail. The fork with 100mm of travel absorbs rough "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"terrain. Fat Kenda Booster tires give you grip in corners and on wet trails. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"The Shimano Tourney drivetrain offered enough gears for finding a comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"pace to ride uphill, and the Tektro hydraulic disc brakes break smoothly. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"Whether you want an affordable bike that you can take to work, but also take "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"trail in mountains on the weekends or you’re just after a stable, comfortable "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"ride for the bike path, the Summit gives a good value for money.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"new\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s">" {"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"pickup_zone\": \"POLYGON((12.4464 42.1028, 12.5464 42.1028, "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"12.5464 41.7028, 12.4464 41.7028, 12.4464 42.1028))\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"store_location\": \"12.4964,41.9028\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"model\": \"ThrillCycle\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"brand\": \"BikeShind\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"price\": 815,"</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"description\": \"An artsy, retro-inspired bicycle that’s as "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"functional as it is pretty: The ThrillCycle steel frame offers a smooth ride. "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"A 9-speed drivetrain has enough gears for coasting in the city, but we wouldn’t "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"suggest taking it to the mountains. Fenders protect you from mud, and a rear "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"basket lets you transport groceries, flowers and books. The ThrillCycle comes "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"with a limited lifetime warranty, so this little guy will last you long "</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">"past graduation.\","</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" \"condition\": \"refurbished\""</span>
</span></span><span class="line"><span class="cl"> <span class="o">+</span> <span class="s">" }"</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">bicycleJsons</span><span class="o">.</span><span class="na">length</span><span class="o">;</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"bicycle:"</span> <span class="o">+</span> <span class="n">i</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="n">bicycleJsons</span><span class="o">[</span><span class="n">i</span><span class="o">]);</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@price:[270 270]"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res1</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs1</span> <span class="o">=</span> <span class="n">res1</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs1</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs1</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="s">"*"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">FTSearchParams</span><span class="o">.</span><span class="na">searchParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">filter</span><span class="o">(</span><span class="s">"price"</span><span class="o">,</span> <span class="mi">270</span><span class="o">,</span> <span class="mi">270</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res2</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs2</span> <span class="o">=</span> <span class="n">res2</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs2</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs2</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span> <span class="s">"@condition:{new}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res3</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs3</span> <span class="o">=</span> <span class="n">res3</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs3</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs3</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="c1">// >>> bicycle:5
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:0
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:6
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:7
</span></span></span><span class="line"><span class="cl"><span class="c1"></span> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SchemaField</span><span class="o">[]</span> <span class="n">emailSchema</span> <span class="o">=</span> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">TextField</span><span class="o">.</span><span class="na">of</span><span class="o">(</span><span class="s">"$.email"</span><span class="o">).</span><span class="na">as</span><span class="o">(</span><span class="s">"email"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">ftCreate</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="o">()</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">addPrefix</span><span class="o">(</span><span class="s">"key:"</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">.</span><span class="na">on</span><span class="o">(</span><span class="n">IndexDataType</span><span class="o">.</span><span class="na">JSON</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="n">emailSchema</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">jsonSet</span><span class="o">(</span><span class="s">"key:1"</span><span class="o">,</span> <span class="n">Path2</span><span class="o">.</span><span class="na">ROOT_PATH</span><span class="o">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="o">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:email"</span><span class="o">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">RediSearchUtil</span><span class="o">.</span><span class="na">escapeQuery</span><span class="o">(</span><span class="s">"@email{[email protected]}"</span><span class="o">),</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">FTSearchParams</span><span class="o">().</span><span class="na">dialect</span><span class="o">(</span><span class="mi">2</span><span class="o">)</span>
</span></span><span class="line"><span class="cl"> <span class="o">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res4</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="o">=</span> <span class="n">jedis</span><span class="o">.</span><span class="na">ftSearch</span><span class="o">(</span><span class="s">"idx:bicycle"</span><span class="o">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"@description:\"rough terrain\""</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">res5</span><span class="o">.</span><span class="na">getTotalResults</span><span class="o">());</span> <span class="c1">// >>> 1
</span></span></span><span class="line hl"><span class="cl"><span class="c1"></span>
</span></span><span class="line hl"><span class="cl"> <span class="n">List</span><span class="o"><</span><span class="n">Document</span><span class="o">></span> <span class="n">docs5</span> <span class="o">=</span> <span class="n">res5</span><span class="o">.</span><span class="na">getDocuments</span><span class="o">();</span>
</span></span><span class="line hl"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="k">for</span> <span class="o">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="o">;</span> <span class="n">i</span> <span class="o"><</span> <span class="n">docs5</span><span class="o">.</span><span class="na">size</span><span class="o">();</span> <span class="n">i</span><span class="o">++)</span> <span class="o">{</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="n">docs5</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="n">i</span><span class="o">).</span><span class="na">getId</span><span class="o">());</span>
</span></span><span class="line hl"><span class="cl"> <span class="o">}</span>
</span></span><span class="line hl"><span class="cl"> <span class="c1">// >>> bicycle:8
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.
</span></span></span><span class="line"><span class="cl"><span class="c1"></span>
</span></span><span class="line"><span class="cl"> <span class="n">jedis</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Java_query_em-stepem4')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Java_query_em-stepem4" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/java/jedis/" tabindex="1" title="Quick-Start">
Java Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/jedis/tree/master/src/test/java/io/redis/examples/QueryEmExample.java" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
<input class="radiotab w-0 h-0" data-lang="dotnet" id="Csharp_query_em-stepem4" name="query_em-stepem4" tabindex="1" type="radio"/>
<label class="justify-left label ml-4 pt-3.5 px-3 pb-1 cursor-pointer text-sm text-center bg-redis-ink-900 hover:text-redis-red-600 rounded rounded-mx transition duration-150 ease-in-out" for="Csharp_query_em-stepem4" title="Open example">
C#
</label>
<div aria-labelledby="tab-query_em-stepem4" class="panel order-last hidden w-full mt-0 relative" id="panel_Csharp_query_em-stepem4" role="tabpanel" tabindex="0">
<div class="highlight">
<pre class="chroma"><code class="language-C#" data-lang="C#"><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.RedisStackCommands</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Search.Literals.Enums</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">NRedisStack.Tests</span><span class="p">;</span>
</span></span><span class="line"><span class="cl"><span class="k">using</span> <span class="nn">StackExchange.Redis</span><span class="p">;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">public</span> <span class="k">class</span> <span class="nc">QueryEmExample</span>
</span></span><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">public</span> <span class="k">void</span> <span class="n">run</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">muxer</span> <span class="p">=</span> <span class="n">ConnectionMultiplexer</span><span class="p">.</span><span class="n">Connect</span><span class="p">(</span><span class="s">"localhost:6379"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">db</span> <span class="p">=</span> <span class="n">muxer</span><span class="p">.</span><span class="n">GetDatabase</span><span class="p">();</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">idxParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"bicycle:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">bikeSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTextField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.description"</span><span class="p">,</span> <span class="s">"description"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddNumericField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.price"</span><span class="p">,</span> <span class="s">"price"</span><span class="p">))</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.condition"</span><span class="p">,</span> <span class="s">"condition"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:bicycle"</span><span class="p">,</span> <span class="n">idxParams</span><span class="p">,</span> <span class="n">bikeSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="kt">var</span> <span class="n">bicycles</span> <span class="p">=</span> <span class="k">new</span> <span class="kt">object</span><span class="p">[]</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Velorim"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Jigger"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">270</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Small and powerful, the Jigger is the best ride "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"for the smallest of tikes! This is the tiniest "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"kids’ pedal bike on the market available without"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a coaster brake, the Jigger is the vehicle of "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"choice for the rare tenacious little rider "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"raring to go."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Bicyk"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Hillcraft"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Kids want to ride with as little weight as possible."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Especially on an incline! They may be at the age "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"when a 27.5 inch wheel bike is just too clumsy coming "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"off a 24 inch bike. The Hillcraft 26 is just the solution"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" they need!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Nord"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Chook air 5"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The Chook Air 5 gives kids aged six years and older "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"a durable and uberlight mountain bike for their first"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" experience on tracks and easy cruising through forests"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and fields. The lower top tube makes it easy to mount"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and dismount in any situation, giving your kids greater"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" safety on the trails."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Eva"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Eva 291"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3400</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The sister company to Nord, Eva launched in 2005 as the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" first and only women-dedicated bicycle brand. Designed"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" by women for women, allEva bikes are optimized for the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" feminine physique using analytics from a body metrics"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" database. If you like 29ers, try the Eva 291. It’s a "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"brand new bike for 2022.. This full-suspension, "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"cross-country ride has been designed for velocity. The"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 291 has 100mm of front and rear travel, a superlight "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"aluminum frame and fast-rolling 29-inch wheels. Yippee!"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Noka Bikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Kahuna"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">3200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"Whether you want to try your hand at XC racing or are "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"looking for a lively trail bike that's just as inspiring"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" on the climbs as it is over rougher ground, the Wilder"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" is one heck of a bike built specifically for short women."</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Both the frames and components have been tweaked to "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"include a women’s saddle, different bars and unique "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"colourway."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"used"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Breakout"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"XBN 2.1 Alloy"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">810</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The XBN 2.1 Alloy is our entry-level road bike – but that’s"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" not to say that it’s a basic machine. With an internal "</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">"weld aluminium frame, a full carbon fork, and the slick-shifting"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Claris gears from Shimano’s, this is a bike which doesn’t"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" break the bank and delivers craved performance."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"ScramBikes"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"WattBike"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">2300</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"The WattBike is the best e-bike for people who still feel young"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" at heart. It has a Bafang 1000W mid-drive system and a 48V"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 17.5AH Samsung Lithium-Ion battery, allowing you to ride for"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" more than 60 miles on one charge. It’s great for tackling hilly"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" terrain or if you just fancy a more leisurely ride. With three"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" working modes, you can choose between E-bike, assisted bicycle,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and normal bike modes."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"Peaknetic"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Secto"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">430</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"If you struggle with stiff fingers or a kinked neck or back after"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a few minutes on the road, this lightweight, aluminum bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" alleviates those issues and allows you to enjoy the ride. From"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" the ergonomic grips to the lumbar-supporting seat position, the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Roll Low-Entry offers incredible comfort. The rear-inclined seat"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" tube facilitates stability by allowing you to put a foot on the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" ground to balance at a stop, and the low step-over frame makes it"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" accessible for all ability and mobility levels. The saddle is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" very soft, with a wide back to support your hip joints and a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" cutout in the center to redistribute that pressure. Rim brakes"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" deliver satisfactory braking control, and the wide tires provide"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" a smooth, stable ride on paved roads and gravel. Rack and fender"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mounts facilitate setting up the Roll Low-Entry as your preferred"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" commuter, and the BMX-like handlebar offers space for mounting a"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flashlight, bell, or phone holder."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"nHill"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"Summit"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">1200</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"This budget mountain bike from nHill performs well both on bike"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" paths and on the trail. The fork with 100mm of travel absorbs"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" rough terrain. Fat Kenda Booster tires give you grip in corners"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" and on wet trails. The Shimano Tourney drivetrain offered enough"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" gears for finding a comfortable pace to ride uphill, and the"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" Tektro hydraulic disc brakes break smoothly. Whether you want an"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" affordable bike that you can take to work, but also take trail in"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" mountains on the weekends or you’re just after a stable,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" comfortable ride for the bike path, the Summit gives a good value"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" for money."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"new"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span> <span class="p">=</span> <span class="s">"ThrillCycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">brand</span> <span class="p">=</span> <span class="s">"BikeShind"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">price</span> <span class="p">=</span> <span class="m">815</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">description</span> <span class="p">=</span> <span class="s">"An artsy, retro-inspired bicycle that’s as functional as it is"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" pretty: The ThrillCycle steel frame offers a smooth ride. A"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" 9-speed drivetrain has enough gears for coasting in the city, but"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" we wouldn’t suggest taking it to the mountains. Fenders protect"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" you from mud, and a rear basket lets you transport groceries,"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" flowers and books. The ThrillCycle comes with a limited lifetime"</span> <span class="p">+</span>
</span></span><span class="line"><span class="cl"> <span class="s">" warranty, so this little guy will last you long past graduation."</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">condition</span> <span class="p">=</span> <span class="s">"refurbished"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">};</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="k">for</span> <span class="p">(</span><span class="kt">var</span> <span class="n">i</span> <span class="p">=</span> <span class="m">0</span><span class="p">;</span> <span class="n">i</span> <span class="p"><</span> <span class="n">bicycles</span><span class="p">.</span><span class="n">Length</span><span class="p">;</span> <span class="n">i</span><span class="p">++)</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">$"bicycle:{i}"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="n">bicycles</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res1</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@price:[270 270]"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res1</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res2</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">().</span><span class="n">AddFilter</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">.</span><span class="n">NumericFilter</span><span class="p">(</span><span class="s">"price"</span><span class="p">,</span> <span class="m">270</span><span class="p">,</span> <span class="m">270</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res2</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em1' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res3</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@condition:{new}"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res3</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 4</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em2' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Schema</span> <span class="n">emailSchema</span> <span class="p">=</span> <span class="k">new</span> <span class="n">Schema</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddTagField</span><span class="p">(</span><span class="k">new</span> <span class="n">FieldName</span><span class="p">(</span><span class="s">"$.email"</span><span class="p">,</span> <span class="s">"email"</span><span class="p">));</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">FTCreateParams</span> <span class="n">emailParams</span> <span class="p">=</span> <span class="k">new</span> <span class="n">FTCreateParams</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">AddPrefix</span><span class="p">(</span><span class="s">"key:"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">.</span><span class="n">On</span><span class="p">(</span><span class="n">IndexDataType</span><span class="p">.</span><span class="n">JSON</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Create</span><span class="p">(</span><span class="s">"idx:email"</span><span class="p">,</span> <span class="n">emailParams</span><span class="p">,</span> <span class="n">emailSchema</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">db</span><span class="p">.</span><span class="n">JSON</span><span class="p">().</span><span class="n">Set</span><span class="p">(</span><span class="s">"key:1"</span><span class="p">,</span> <span class="s">"$"</span><span class="p">,</span> <span class="s">"{\"email\": \"[email protected]\"}"</span><span class="p">);</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res4</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="s">"idx:email"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@email:{test\\@redis\\.com}"</span><span class="p">).</span><span class="n">Dialect</span><span class="p">(</span><span class="m">2</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="p">);</span>
</span></span><span class="line"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res4</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em3' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line hl"><span class="cl"> <span class="n">SearchResult</span> <span class="n">res5</span> <span class="p">=</span> <span class="n">db</span><span class="p">.</span><span class="n">FT</span><span class="p">().</span><span class="n">Search</span><span class="p">(</span>
</span></span><span class="line hl"><span class="cl"> <span class="s">"idx:bicycle"</span><span class="p">,</span>
</span></span><span class="line hl"><span class="cl"> <span class="k">new</span> <span class="n">Query</span><span class="p">(</span><span class="s">"@description:\"rough terrain\""</span><span class="p">)</span>
</span></span><span class="line hl"><span class="cl"> <span class="p">);</span>
</span></span><span class="line hl"><span class="cl"> <span class="n">Console</span><span class="p">.</span><span class="n">WriteLine</span><span class="p">(</span><span class="n">res5</span><span class="p">.</span><span class="n">TotalResults</span><span class="p">);</span> <span class="c1">// >>> 1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="c1">// Tests for 'em4' step.</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl">
</span></span></code></pre>
</div>
<button class="clipboard-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-10 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="copyCodeToClipboard('#panel_Csharp_query_em-stepem4')" tabindex="1" title="Copy to clipboard">
<svg fill="currentColor" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M9 43.95q-1.2 0-2.1-.9-.9-.9-.9-2.1V10.8h3v30.15h23.7v3Zm6-6q-1.2 0-2.1-.9-.9-.9-.9-2.1v-28q0-1.2.9-2.1.9-.9 2.1-.9h22q1.2 0 2.1.9.9.9.9 2.1v28q0 1.2-.9 2.1-.9.9-2.1.9Zm0-3h22v-28H15v28Zm0 0v-28 28Z">
</path>
</svg>
<div class="tooltip relative inline-block">
<span class="tooltiptext hidden bg-slate-200 rounded rounded-mx text-slate-800 text-center text-xs p-1 absolute right-6 bottom-4">
Copied!
</span>
</div>
</button>
<button aria-controls="panel_Csharp_query_em-stepem4" class="visibility-button text-neutral-400 hover:text-slate-100 bg-slate-600 absolute -top-8 right-2 h-7 w-7 mr-2 mt-2 p-1 rounded rounded-mx" onclick="toggleVisibleLines(this)" tabindex="1" title="Toggle visibility">
<svg class="hidden" fill="currentColor" id="visibility-off" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="m31.45 27.05-2.2-2.2q1.3-3.55-1.35-5.9-2.65-2.35-5.75-1.2l-2.2-2.2q.85-.55 1.9-.8 1.05-.25 2.15-.25 3.55 0 6.025 2.475Q32.5 19.45 32.5 23q0 1.1-.275 2.175-.275 1.075-.775 1.875Zm6.45 6.45-2-2q2.45-1.8 4.275-4.025Q42 25.25 42.85 23q-2.5-5.55-7.5-8.775Q30.35 11 24.5 11q-2.1 0-4.3.4-2.2.4-3.45.95L14.45 10q1.75-.8 4.475-1.4Q21.65 8 24.25 8q7.15 0 13.075 4.075Q43.25 16.15 46 23q-1.3 3.2-3.35 5.85-2.05 2.65-4.75 4.65Zm2.9 11.3-8.4-8.25q-1.75.7-3.95 1.075T24 38q-7.3 0-13.25-4.075T2 23q1-2.6 2.775-5.075T9.1 13.2L2.8 6.9l2.1-2.15L42.75 42.6ZM11.15 15.3q-1.85 1.35-3.575 3.55Q5.85 21.05 5.1 23q2.55 5.55 7.675 8.775Q17.9 35 24.4 35q1.65 0 3.25-.2t2.4-.6l-3.2-3.2q-.55.25-1.35.375T24 31.5q-3.5 0-6-2.45T15.5 23q0-.75.125-1.5T16 20.15Zm15.25 7.1Zm-5.8 2.9Z">
</path>
</svg>
<svg fill="currentColor" id="visibility-on" viewbox="0 0 48 48" xmlns="http://www.w3.org/2000/svg">
<path d="M24 31.5q3.55 0 6.025-2.475Q32.5 26.55 32.5 23q0-3.55-2.475-6.025Q27.55 14.5 24 14.5q-3.55 0-6.025 2.475Q15.5 19.45 15.5 23q0 3.55 2.475 6.025Q20.45 31.5 24 31.5Zm0-2.9q-2.35 0-3.975-1.625T18.4 23q0-2.35 1.625-3.975T24 17.4q2.35 0 3.975 1.625T29.6 23q0 2.35-1.625 3.975T24 28.6Zm0 9.4q-7.3 0-13.2-4.15Q4.9 29.7 2 23q2.9-6.7 8.8-10.85Q16.7 8 24 8q7.3 0 13.2 4.15Q43.1 16.3 46 23q-2.9 6.7-8.8 10.85Q31.3 38 24 38Zm0-15Zm0 12q6.05 0 11.125-3.275T42.85 23q-2.65-5.45-7.725-8.725Q30.05 11 24 11t-11.125 3.275Q7.8 17.55 5.1 23q2.7 5.45 7.775 8.725Q17.95 35 24 35Z">
</path>
</svg>
</button>
<div class="cli-footer flex items-center justify-between rounded-b-md bg-slate-900 mt-0 px-4 pt-0 mb-0 transition-opacity ease-in-out duration-300 opacity-0 invisible group-hover:opacity-100 group-hover:visible">
<a class="rounded rounded-mx px-3 py-1 text-white text-xs hover:text-white hover:bg-slate-600 hover:border-transparent focus:outline-none focus:ring-2 focus:white focus:border-slate-500" href="https://redis.io/docs/latest/develop/connect/clients/dotnet/" tabindex="1" title="Quick-Start">
C# Quick-Start
</a>
<div class="w-1/2">
</div>
<div class="flex-1 text-right">
<a class="button text-neutral-400 hover:text-slate-100 h-6 w-6 p-1" href="https://github.com/redis/NRedisStack/tree/master/tests/Doc/QueryEmExample.cs" tabindex="1" title="Improve this code example">
<svg fill="github" height="16" viewbox="0 0 18 16" width="18" xmlns="http://www.w3.org/2000/svg">
<path clip-rule="evenodd" d="M8.99953 1.43397e-06C7.09918 -0.000897921 5.26058 0.674713 3.81295 1.90585C2.36533 3.13699 1.40324 4.84324 1.09896 6.71907C0.794684 8.5949 1.1681 10.5178 2.15233 12.1434C3.13657 13.769 4.66734 14.9912 6.47053 15.591C6.87053 15.664 7.01653 15.417 7.01653 15.205C7.01653 15.015 7.00953 14.512 7.00553 13.845C4.78053 14.328 4.31053 12.772 4.31053 12.772C4.16325 12.2887 3.84837 11.8739 3.42253 11.602C2.69653 11.102 3.47753 11.116 3.47753 11.116C3.73043 11.1515 3.97191 11.2442 4.18365 11.3869C4.39539 11.5297 4.57182 11.7189 4.69953 11.94C4.80755 12.1377 4.95378 12.3119 5.12972 12.4526C5.30567 12.5933 5.50782 12.6976 5.72442 12.7595C5.94103 12.8214 6.16778 12.8396 6.39148 12.813C6.61519 12.7865 6.83139 12.7158 7.02753 12.605C7.06381 12.1992 7.24399 11.8197 7.53553 11.535C5.75953 11.335 3.89153 10.647 3.89153 7.581C3.88005 6.78603 4.17513 6.01716 4.71553 5.434C4.47318 4.74369 4.50322 3.98693 4.79953 3.318C4.79953 3.318 5.47053 3.103 6.99953 4.138C8.31074 3.77905 9.69432 3.77905 11.0055 4.138C12.5325 3.103 13.2055 3.318 13.2055 3.318C13.5012 3.9877 13.5294 4.74513 13.2845 5.435C13.8221 6.01928 14.114 6.78817 14.0995 7.582C14.0995 10.655 12.2285 11.332 10.4465 11.53C10.6375 11.724 10.7847 11.9566 10.8784 12.2123C10.972 12.4679 11.0099 12.7405 10.9895 13.012C10.9895 14.081 10.9795 14.944 10.9795 15.206C10.9795 15.42 11.1235 15.669 11.5295 15.591C13.3328 14.9911 14.8636 13.7689 15.8479 12.1432C16.8321 10.5175 17.2054 8.59447 16.901 6.71858C16.5966 4.84268 15.6343 3.13642 14.1865 1.90536C12.7387 0.674306 10.9 -0.0011359 8.99953 1.43397e-06Z" fill="white" fill-rule="evenodd">
</path>
</svg>
</a>
</div>
</div>
</div>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/query/exact-match/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/security/manage-rec-credentials/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage Redis Enterprise cluster (REC) credentials
</h1>
<p>
Redis Enterprise for Kubernetes uses a custom resource called
<a href="/docs/latest/operate/kubernetes/reference/redis_enterprise_cluster_api/">
<code>
RedisEnterpriseCluster
</code>
</a>
to create a Redis Enterprise cluster (REC). During creation it generates random credentials for the operator to use. The credentials are saved in a Kubernetes (K8s)
<a href="https://kubernetes.io/docs/concepts/configuration/secret/">
secret
</a>
. The secret name defaults to the name of the cluster.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
This procedure is only supported for operator versions 6.0.20-12 and above.
</div>
</div>
<h2 id="retrieve-the-current-username-and-password">
Retrieve the current username and password
</h2>
<p>
The credentials can be used to access the Redis Enterprise admin console or the API. Connectivity must be configured to the REC
<a href="https://kubernetes.io/docs/concepts/workloads/pods/">
pods
</a>
using an appropriate service (or port forwarding).
</p>
<ol>
<li>
<p>
Inspect the random username and password created by the operator during creation with the
<code>
kubectl get secret
</code>
command.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get secret rec -o <span class="nv">jsonpath</span><span class="o">=</span><span class="s1">'{.data}'</span>
</span></span></code></pre>
</div>
<p>
The command outputs the encoded password and username, similar to the example below.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">map<span class="o">[</span>password:MTIzNDU2NzgK username:ZGVtb0BleGFtcGxlLmNvbQo<span class="o">=]</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
Decode the password and username with the
<code>
echo
</code>
command and the password from the previous step.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> MTIzNDU2NzgK <span class="p">|</span> base64 --decode
</span></span></code></pre>
</div>
<p>
This outputs the password and username in plain text. In this example, the plain text password is
<code>
12345678
</code>
and the username is
<code>
[email protected]
</code>
.
</p>
</li>
</ol>
<h2 id="change-the-redis-enterprise-cluster-rec-credentials">
Change the Redis Enterprise cluster (REC) credentials
</h2>
<h3 id="change-the-rec-password-for-the-current-username">
Change the REC password for the current username
</h3>
<ol>
<li>
<p>
Access a
<a href="https://kubernetes.io/docs/concepts/workloads/pods/">
pod
</a>
running a Redis Enterprise cluster.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl <span class="nb">exec</span> -it <rec-resource-name>-0 bash
</span></span></code></pre>
</div>
</li>
<li>
<p>
Add a new password for the existing user.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"> <span class="nv">REC_USER</span><span class="o">=</span><span class="s2">"`cat /opt/redislabs/credentials/username`"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> <span class="nv">REC_PASSWORD</span><span class="o">=</span><span class="s2">"`cat /opt/redislabs/credentials/password`"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> curl -k --request POST <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --url https://localhost:9443/v1/users/password <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -u <span class="s2">"</span><span class="nv">$REC_USER</span><span class="s2">:</span><span class="nv">$REC_PASSWORD</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --header <span class="s1">'Content-Type: application/json'</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --data <span class="s2">"{\"username\":\"</span><span class="nv">$REC_USER</span><span class="s2">\", \
</span></span></span><span class="line"><span class="cl"><span class="s2"> \"old_password\":\"</span><span class="nv">$REC_PASSWORD</span><span class="s2">\", \
</span></span></span><span class="line"><span class="cl"><span class="s2"> \"new_password\":\"<NEW PASSWORD>\"}"</span>
</span></span></code></pre>
</div>
</li>
<li>
<p>
From outside the pod, update the REC credential secret.
</p>
<ol>
<li>
<p>
Save the existing username to a text file .
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> -n <span class="s2">"<current_username>"</span> > username
</span></span></code></pre>
</div>
</li>
<li>
<p>
Save the new password to a text file.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> -n <span class="s2">"<new_password>"</span> > password
</span></span></code></pre>
</div>
</li>
<li>
<p>
Update the REC credential secret.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl create secret generic <cluster_secret_name> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --from-file<span class="o">=</span>./username <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --from-file<span class="o">=</span>./password --dry-run <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -o yaml
</span></span><span class="line"><span class="cl">kubectl apply -f
</span></span></code></pre>
</div>
</li>
</ol>
</li>
<li>
<p>
Wait five minutes for all the components to read the new password from the updated secret. If you proceed to the next step too soon, the account could get locked.
</p>
</li>
<li>
<p>
Access a pod running a Redis Enterprise cluster again.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl <span class="nb">exec</span> -it <rec-resource-name>-0 bash
</span></span></code></pre>
</div>
</li>
<li>
<p>
Remove the previous password to ensure only the new one applies.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nv">REC_USER</span><span class="o">=</span><span class="s2">"`cat /opt/redislabs/credentials/username`"</span><span class="p">;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span><span class="nv">REC_PASSWORD</span><span class="o">=</span><span class="s2">"`cat /opt/redislabs/credentials/password`"</span><span class="p">;</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span>curl -k --request DELETE <span class="se">\ </span>
</span></span><span class="line"><span class="cl"> --url https://localhost:9443/v1/users/password <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -u <span class="s2">"</span><span class="nv">$REC_USER</span><span class="s2">:</span><span class="nv">$REC_PASSWORD</span><span class="s2">"</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --header <span class="s1">'Content-Type: application/json'</span> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --data <span class="s2">"{\"username\":\"</span><span class="nv">$REC_USER</span><span class="s2">\", \
</span></span></span><span class="line"><span class="cl"><span class="s2"> \"old_password\":\"<OLD PASSWORD\"}"</span>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The username for the K8s secret is the email displayed on the Redis Enterprise admin console.
</div>
</div>
</li>
</ol>
<h3 id="change-both-the-rec-username-and-password">
Change both the REC username and password
</h3>
<ol>
<li>
<p>
<a href="/docs/latest/operate/kubernetes/re-clusters/connect-to-admin-console/">
Connect to the admin console
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/security/access-control/create-users/">
Add another admin user
</a>
and choose a new password.
</p>
</li>
<li>
<p>
Specify the new username in the
<code>
username
</code>
field of your REC custom resource spec.
</p>
</li>
<li>
<p>
Update the REC credential secret:
</p>
<ol>
<li>
<p>
Save the existing username to a text file.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> -n <span class="s2">"<current_username>"</span> > username
</span></span></code></pre>
</div>
</li>
<li>
<p>
Save the new password to a text file.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="nb">echo</span> -n <span class="s2">"<new_password>"</span> > password
</span></span></code></pre>
</div>
</li>
<li>
<p>
Update the REC credential secret.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl create secret generic <cluster_secret_name> <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --from-file<span class="o">=</span>./username <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> --from-file<span class="o">=</span>./password --dry-run <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> -o yaml
</span></span><span class="line"><span class="cl">kubectl apply -f
</span></span></code></pre>
</div>
</li>
</ol>
</li>
<li>
<p>
Wait five minutes for all the components to read the new password from the updated secret. If you proceed to the next step too soon, the account could get locked.
</p>
</li>
<li>
<p>
Delete the previous admin user from the cluster.
</p>
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
The operator may log errors in the time between updating the username in the REC spec and the secret update.
</div>
</div>
<h3 id="update-the-credentials-secret-in-vault">
Update the credentials secret in Vault
</h3>
<p>
If you store your secrets with Hashicorp Vault, update the secret for the REC credentials with the following key-value pairs:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">username:<desired_username>, password:<desired_password>
</span></span></code></pre>
</div>
<p>
For more information about Vault integration with the Redis Enterprise Cluster see
<a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/blob/65eba63a6aac69455a691652218e28b0873e4de3/vault/README.md">
Integrating Redis Enterprise for Kubernetes with Hashicorp Vault
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/security/manage-rec-credentials/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/crdb/remove-instance/.html | <section class="prose w-full py-12 max-w-none">
<h1>
crdb-cli crdb remove-instance
</h1>
<p class="text-lg -mt-5 mb-10">
Removes a peer replica from an Active-Active database.
</p>
<p>
Removes a peer replica instance from the Active-Active database and deletes the instance and its data from the participating cluster.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli crdb remove-instance --crdb-guid <guid>
</span></span><span class="line"><span class="cl"> --instance-id <instance-id>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> --force <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">[</span> --no-wait <span class="o">]</span>
</span></span></code></pre>
</div>
<p>
If the cluster cannot communicate with the instance that you want to remove, you can:
</p>
<ol>
<li>
<p>
Use the
<code>
--force
</code>
option to remove the instance from the Active-Active database without purging the data from the instance.
</p>
</li>
<li>
<p>
Run
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/crdb/purge-instance/">
<code>
crdb-cli crdb purge-instance
</code>
</a>
from the removed instance to delete the Active-Active database and its data.
</p>
</li>
</ol>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
crdb-guid
</td>
<td>
string
</td>
<td>
The GUID of the database (required)
</td>
</tr>
<tr>
<td>
instance-id
</td>
<td>
string
</td>
<td>
The ID of the local instance to remove (required)
</td>
</tr>
<tr>
<td>
force
</td>
<td>
</td>
<td>
Removes the instance without purging data from the instance.
<br/>
If --force is specified, you must run
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/crdb/purge-instance/">
<code>
crdb-cli crdb purge-instance
</code>
</a>
from the removed instance.
</td>
</tr>
<tr>
<td>
no-wait
</td>
<td>
</td>
<td>
Does not wait for the task to complete
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns the task ID of the task that is deleting the instance.
</p>
<p>
If
<code>
--no-wait
</code>
is specified, the command exits. Otherwise, it will wait for the instance to be removed and return
<code>
finished
</code>
.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ crdb-cli crdb remove-instance --crdb-guid db6365b5-8aca-4055-95d8-7eb0105c0b35 --instance-id <span class="m">2</span> --force
</span></span><span class="line"><span class="cl">Task b1eba5ba-90de-49e9-8678-d66daa1afb51 created
</span></span><span class="line"><span class="cl"> ---> Status changed: queued -> started
</span></span><span class="line"><span class="cl"> ---> Status changed: started -> finished
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/crdb/remove-instance/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/crdbs/purge/.html | <section class="prose w-full py-12 max-w-none">
<h1>
CRDB purge requests
</h1>
<p class="text-lg -mt-5 mb-10">
Purge removed Active-Active database requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#put-crdbs-purge">
PUT
</a>
</td>
<td>
<code>
/v1/crdbs/{crdb_guid}/purge
</code>
</td>
<td>
Purge data from an instance that was forcibly removed from the Active-Active database
</td>
</tr>
</tbody>
</table>
<h2 id="put-crdbs-purge">
Purge data from removed instance
</h2>
<pre><code>PUT /v1/crdbs/{crdb_guid}/purge
</code></pre>
<p>
Purge the data from an instance that was removed from the
Active-Active database by force.
</p>
<p>
When you force the removal of an instance from an Active-Active
database, the removed instance keeps the data and configuration
according to the last successful synchronization.
</p>
<p>
To delete the data and configuration from the forcefully removed
instance you must use this API (Must be executed locally on the
removed instance).
</p>
<h3 id="put-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>PUT /crdbs/1/purge
</code></pre>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
crdb_guid
</td>
<td>
string
</td>
<td>
Globally unique Active-Active database ID (GUID)
</td>
</tr>
</tbody>
</table>
<h4 id="request-body">
Request body
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
instances
</td>
<td>
array of integers
</td>
<td>
Array of unique instance IDs
</td>
</tr>
</tbody>
</table>
<h3 id="put-response">
Response
</h3>
<p>
Returns a
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/crdb_task/">
CRDB task object
</a>
.
</p>
<h3 id="put-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Action was successful.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
The request is invalid or malformed.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.2">
401 Unauthorized
</a>
</td>
<td>
Unauthorized request. Invalid credentials
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Configuration, instance, or Active-Active database not found.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/crdbs/purge/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/api/examples/dryrun-cost-estimates/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Estimate cost
</h1>
<p class="text-lg -mt-5 mb-10">
How to evaluate the cost of a specific subscription or database without changing existing resources.
</p>
<p>
When you change your subscriptions and databases, you also change the cost of your deployment.
With a
<strong>
dry-run request
</strong>
, you can evaluate the impact and obtain a new cost estimate before you deploy these changes:
</p>
<ul>
<li>
Create subscription
</li>
<li>
Create a database
</li>
<li>
Update a database
</li>
</ul>
<h2 id="defining-a-dry-run-request">
Defining a dry-run request
</h2>
<p>
API operations that support dry-run requests accept the
<code>
dryRun
</code>
boolean parameter in the JSON request body.
</p>
<p>
For example, the JSON body of a create subscription request body can include the
<code>
dryRun=true
</code>
parameter:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"DryRun Cost evaluation subscription"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"dryRun"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"paymentMethodId"</span><span class="p">:</span> <span class="mi">8240</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cloudProviders"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cloudAccountId"</span><span class="p">:</span> <span class="mi">16424</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"regions"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"region"</span><span class="p">:</span> <span class="s2">"us-east-1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"networking"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"deploymentCIDR"</span><span class="p">:</span> <span class="s2">"10.0.0.0/24"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"databases"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-a"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mf">0.1</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h2 id="executing-a-dry-run-request">
Executing a dry-run request
</h2>
<p>
Dry-run requests behave like regular requests except that no changes are made to existing resources.
A dry-run request produces a cost evaluation report for the subscription.
</p>
<table>
<thead>
<tr>
<th>
API Operation
</th>
<th>
<code>
dryRun=false
</code>
(default)
</th>
<th>
<code>
dryRun=true
</code>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Create subscription
</strong>
</td>
<td>
Create a subscription
</td>
<td>
Returns a cost evaluation report of the planned subscription
</td>
</tr>
<tr>
<td>
<strong>
Create database
</strong>
</td>
<td>
Creates a new database in the subscription
</td>
<td>
Returns a cost evaluation report for the relevant subscription
</td>
</tr>
<tr>
<td>
<strong>
Update database
</strong>
</td>
<td>
Changes the specified database
</td>
<td>
Returns a cost evaluation report and evaluates whether the relevant subscription requires additional resources based on the database modification
</td>
</tr>
</tbody>
</table>
<h3 id="example-of-a-dry-run-request--response">
Example of a dry-run request & response
</h3>
<p>
This section demonstrates a complete example of a create subscription dry-run request and response.
</p>
<h4 id="dry-run-request-body">
Dry-run request body
</h4>
<p>
Here is an example of the pricing request body:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"DryRun Cost evaluation subscription"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"dryRun"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"paymentMethodId"</span><span class="p">:</span> <span class="mi">8240</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cloudProviders"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cloudAccountId"</span><span class="p">:</span> <span class="mi">16424</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"regions"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"region"</span><span class="p">:</span> <span class="s2">"us-east-1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"networking"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"deploymentCIDR"</span><span class="p">:</span> <span class="s2">"10.0.0.0/24"</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">],</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"databases"</span><span class="p">:</span> <span class="p">[</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-a"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"throughputMeasurement"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"by"</span><span class="p">:</span> <span class="s2">"operations-per-second"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"value"</span><span class="p">:</span> <span class="mi">1000</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mf">0.1</span>
</span></span><span class="line"><span class="cl"> <span class="p">,</span> <span class="nt">"quantity"</span><span class="p">:</span> <span class="mi">3</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-b"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"throughputMeasurement"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"by"</span><span class="p">:</span> <span class="s2">"operations-per-second"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"value"</span><span class="p">:</span> <span class="mi">1000</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"replication"</span><span class="p">:</span> <span class="kc">false</span>
</span></span><span class="line"><span class="cl"> <span class="p">,</span><span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mf">0.1</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-c"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"throughputMeasurement"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"by"</span><span class="p">:</span> <span class="s2">"operations-per-second"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"value"</span><span class="p">:</span> <span class="mi">1000</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"replication"</span><span class="p">:</span> <span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">,</span><span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mi">5</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-d"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"throughputMeasurement"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"by"</span><span class="p">:</span> <span class="s2">"operations-per-second"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"value"</span><span class="p">:</span> <span class="mi">10000</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"replication"</span><span class="p">:</span> <span class="kc">false</span>
</span></span><span class="line"><span class="cl"> <span class="p">,</span><span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mi">12</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"name"</span><span class="p">:</span> <span class="s2">"database-e"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"throughputMeasurement"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"by"</span><span class="p">:</span> <span class="s2">"operations-per-second"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"value"</span><span class="p">:</span> <span class="mi">25000</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"replication"</span><span class="p">:</span> <span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">,</span><span class="nt">"memoryLimitInGb"</span><span class="p">:</span> <span class="mi">25</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span> <span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<ol>
<li>
The create subscription request contains the
<code>
"dryRun": true
</code>
parameter
</li>
<li>
The databases array contains the definitions of multiple database templates, named
<code>
database-a
</code>
,
<code>
database-b
</code>
,
<code>
database-c
</code>
, etc.
</li>
<li>
Note that the databases differ in structure (size, throughput measurement, replication, quantity, etc.)
</li>
</ol>
<h4 id="dry-run-response">
Dry-run response
</h4>
<p>
Here is an example of the pricing response section for the above create subscription dry-run request:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl"><span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"response"</span>: <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"resource"</span>: <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"pricing"</span>: <span class="o">[</span>
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"databaseName"</span>: <span class="s2">"database-a"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"Shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"typeDetails"</span>: <span class="s2">"micro"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 6,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePerUnit"</span>: 0.027,
</span></span><span class="line"><span class="cl"> <span class="s2">"priceCurrency"</span>: <span class="s2">"USD"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePeriod"</span>: <span class="s2">"hour"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"databaseName"</span>: <span class="s2">"database-b"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"Shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"typeDetails"</span>: <span class="s2">"micro"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 1,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePerUnit"</span>: 0.027,
</span></span><span class="line"><span class="cl"> <span class="s2">"priceCurrency"</span>: <span class="s2">"USD"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePeriod"</span>: <span class="s2">"hour"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"databaseName"</span>: <span class="s2">"database-c"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"Shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"typeDetails"</span>: <span class="s2">"high-throughput"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 2,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePerUnit"</span>: 0.124,
</span></span><span class="line"><span class="cl"> <span class="s2">"priceCurrency"</span>: <span class="s2">"USD"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePeriod"</span>: <span class="s2">"hour"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"databaseName"</span>: <span class="s2">"database-d"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"Shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"typeDetails"</span>: <span class="s2">"small"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 1,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePerUnit"</span>: 0.156,
</span></span><span class="line"><span class="cl"> <span class="s2">"priceCurrency"</span>: <span class="s2">"USD"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePeriod"</span>: <span class="s2">"hour"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"databaseName"</span>: <span class="s2">"database-e"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"Shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"typeDetails"</span>: <span class="s2">"large"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 2,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"shards"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePerUnit"</span>: 0.293,
</span></span><span class="line"><span class="cl"> <span class="s2">"priceCurrency"</span>: <span class="s2">"USD"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"pricePeriod"</span>: <span class="s2">"hour"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"EBS Volume"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 345,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"GB"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>,
</span></span><span class="line"><span class="cl"> <span class="o">{</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"type"</span>: <span class="s2">"r5.xlarge"</span>,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantity"</span>: 3,
</span></span><span class="line"><span class="cl"> <span class="s2">"quantityMeasurement"</span>: <span class="s2">"instances"</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">]</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"> <span class="o">}</span>
</span></span><span class="line"><span class="cl"><span class="o">}</span>
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
Some of the response content was omitted for brevity.
</div>
</div>
<ol>
<li>
The
<code>
pricing
</code>
array contains an element for each database, containing the database name and cost evaluation related to that database
</li>
<li>
The database cost is measured in type and number of shards required for the specific database, as defined by the database template in the request. See
<a href="https://redislabs.com/redis-enterprise-cloud/pricing">
Cloud Pricing
</a>
</li>
<li>
The cost evaluation for each database is measured in quantity of the specific shard type required by the requested database. The cost per shard is defined by the fields
<code>
pricePerUnit
</code>
(where
<code>
unit
</code>
is a shard of the specific type),
<code>
priceCurrency
</code>
, and
<code>
pricePeriod
</code>
</li>
<li>
For example, to calculate the total hourly cost of a database, use the following formula:
<code>
pricePerUnit
</code>
*
<code>
quantity
</code>
</li>
<li>
The structure of the pricing response depends on the cloud account used by the request. There are two types of cloud accounts: a cloud account owned, named, and managed by the customer (AWS only) and one maintained by "Redis resources" cloud account (All cloud providers)
</li>
<li>
For a customer-provided cloud account - The cost evaluation response lists the AWS resources required (storage and compute instances) without pricing data (which depends on the specific details of the customer's AWS account)
</li>
<li>
For a Redis internal cloud account (defined a
<code>
cloudAccountId = 1
</code>
in the create subscription request) - The cost evaluation response includes a
<code>
MinimumPrice
</code>
element. This indicates the minimal hourly cost of the entire subscription. This minimum price will be charged if the sum of all shards for all the subscription's databases is less than the specified minimum price
</li>
</ol>
<h3 id="viewing-actual-subscription-cost">
Viewing actual subscription cost
</h3>
<p>
The
<code>
Get subscriptions
</code>
and
<code>
Get subscription by id
</code>
JSON response contains an element named
<code>
subscriptionPricing
</code>
that details the latest calculated cost of a subscription, grouped by shard type for all the databases in the subscription.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/api/examples/dryrun-cost-estimates/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/function-stats/.html | <section class="prose w-full py-12">
<h1 class="command-name">
FUNCTION STATS
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">FUNCTION STATS</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
7.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@scripting
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Return information about the function that's currently running and information about the available execution engines.
</p>
<p>
The reply is map with two keys:
</p>
<ol>
<li>
<code>
running_script
</code>
: information about the running script.
If there's no in-flight function, the server replies with a
<em>
nil
</em>
.
Otherwise, this is a map with the following keys:
</li>
</ol>
<ul>
<li>
<strong>
name:
</strong>
the name of the function.
</li>
<li>
<strong>
command:
</strong>
the command and arguments used for invoking the function.
</li>
<li>
<strong>
duration_ms:
</strong>
the function's runtime duration in milliseconds.
</li>
</ul>
<ol start="2">
<li>
<code>
engines
</code>
: this is a map of maps. Each entry in the map represent a single engine.
Engine map contains statistics about the engine like number of functions and number of libraries.
</li>
</ol>
<p>
You can use this command to inspect the invocation of a long-running function and decide whether kill it with the
<a href="/docs/latest/commands/function-kill/">
<code>
FUNCTION KILL
</code>
</a>
command.
</p>
<p>
For more information please refer to
<a href="/docs/latest/develop/interact/programmability/functions-intro/">
Introduction to Redis Functions
</a>
.
</p>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: information about the function that's currently running and information about the available execution engines.
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#maps">
Map reply
</a>
: information about the function that's currently running and information about the available execution engines.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/function-stats/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/reference/command-tips/.html | <section class="prose w-full py-12">
<h1>
Redis command tips
</h1>
<p class="text-lg -mt-5 mb-10">
Get additional information about a command
</p>
<p>
Command tips are an array of strings.
These provide Redis clients with additional information about the command.
The information can instruct Redis Cluster clients as to how the command should be executed and its output processed in a clustered deployment.
</p>
<p>
Unlike the command's flags (see the 3rd element of
<a href="/docs/latest/commands/command/">
<code>
COMMAND
</code>
</a>
's reply), which are strictly internal to the server's operation, tips don't serve any purpose other than being reported to clients.
</p>
<p>
Command tips are arbitrary strings.
However, the following sections describe proposed tips and demonstrate the conventions they are likely to adhere to.
</p>
<h2 id="nondeterministic_output">
nondeterministic_output
</h2>
<p>
This tip indicates that the command's output isn't deterministic.
That means that calls to the command may yield different results with the same arguments and data.
That difference could be the result of the command's random nature (e.g.,
<a href="/docs/latest/commands/randomkey/">
<code>
RANDOMKEY
</code>
</a>
and
<a href="/docs/latest/commands/spop/">
<code>
SPOP
</code>
</a>
); the call's timing (e.g.,
<a href="/docs/latest/commands/ttl/">
<code>
TTL
</code>
</a>
); or generic differences that relate to the server's state (e.g.,
<a href="/docs/latest/commands/info/">
<code>
INFO
</code>
</a>
and
<a href="/docs/latest/commands/client-list/">
<code>
CLIENT LIST
</code>
</a>
).
</p>
<p>
<strong>
Note:
</strong>
Prior to Redis 7.0, this tip was the
<em>
random
</em>
command flag.
</p>
<h2 id="nondeterministic_output_order">
nondeterministic_output_order
</h2>
<p>
The existence of this tip indicates that the command's output is deterministic, but its ordering is random (e.g.,
<a href="/docs/latest/commands/hgetall/">
<code>
HGETALL
</code>
</a>
and
<a href="/docs/latest/commands/smembers/">
<code>
SMEMBERS
</code>
</a>
).
</p>
<p>
<strong>
Note:
</strong>
Prior to Redis 7.0, this tip was the
<em>
sort
</em>
_
<em>
for
</em>
_
<em>
script
</em>
flag.
</p>
<h2 id="request_policy">
request_policy
</h2>
<p>
This tip can help clients determine the shards to send the command in clustering mode.
The default behavior a client should implement for commands without the
<em>
request_policy
</em>
tip is as follows:
</p>
<ol>
<li>
The command doesn't accept key name arguments: the client can execute the command on an arbitrary shard.
</li>
<li>
For commands that accept one or more key name arguments: the client should route the command to a single shard, as determined by the hash slot of the input keys.
</li>
</ol>
<p>
In cases where the client should adopt a behavior different than the default, the
<em>
request_policy
</em>
tip can be one of:
</p>
<ul>
<li>
<strong>
all_nodes:
</strong>
the client should execute the command on all nodes - masters and replicas alike.
An example is the
<a href="/docs/latest/commands/config-set/">
<code>
CONFIG SET
</code>
</a>
command.
This tip is in-use by commands that don't accept key name arguments.
The command operates atomically per shard.
</li>
</ul>
<ul>
<li>
<strong>
all_shards:
</strong>
the client should execute the command on all master shards (e.g., the
<a href="/docs/latest/commands/dbsize/">
<code>
DBSIZE
</code>
</a>
command).
This tip is in-use by commands that don't accept key name arguments.
The command operates atomically per shard.
</li>
</ul>
<ul>
<li>
<strong>
multi_shard:
</strong>
the client should execute the command on several shards.
The client should split the inputs according to the hash slots of its input key name arguments.
For example, the command
<code>
DEL {foo} {foo}1 bar
</code>
should be split to
<code>
DEL {foo} {foo}1
</code>
and
<code>
DEL bar
</code>
.
If the keys are hashed to more than a single slot, the command must be split even if all the slots are managed by the same shard.
Examples for such commands include
<a href="/docs/latest/commands/mset/">
<code>
MSET
</code>
</a>
,
<a href="/docs/latest/commands/mget/">
<code>
MGET
</code>
</a>
and
<a href="/docs/latest/commands/del/">
<code>
DEL
</code>
</a>
.
However, note that
<a href="/docs/latest/commands/sunionstore/">
<code>
SUNIONSTORE
</code>
</a>
isn't considered as
<em>
multi_shard
</em>
because all of its keys must belong to the same hash slot.
</li>
<li>
<strong>
special:
</strong>
indicates a non-trivial form of the client's request policy, such as the
<a href="/docs/latest/commands/scan/">
<code>
SCAN
</code>
</a>
command.
</li>
</ul>
<h2 id="response_policy">
response_policy
</h2>
<p>
This tip can help clients determine the aggregate they need to compute from the replies of multiple shards in a cluster.
The default behavior for commands without a
<em>
request_policy
</em>
tip only applies to replies with of nested types (i.e., an array, a set, or a map).
The client's implementation for the default behavior should be as follows:
</p>
<ol>
<li>
The command doesn't accept key name arguments: the client can aggregate all replies within a single nested data structure.
For example, the array replies we get from calling
<a href="/docs/latest/commands/keys/">
<code>
KEYS
</code>
</a>
against all shards.
These should be packed in a single in no particular order.
</li>
<li>
For commands that accept one or more key name arguments: the client needs to retain the same order of replies as the input key names.
For example,
<a href="/docs/latest/commands/mget/">
<code>
MGET
</code>
</a>
's aggregated reply.
</li>
</ol>
<p>
The
<em>
response_policy
</em>
tip is set for commands that reply with scalar data types, or when it's expected that clients implement a non-default aggregate.
This tip can be one of:
</p>
<ul>
<li>
<strong>
one_succeeded:
</strong>
the clients should return success if at least one shard didn't reply with an error.
The client should reply with the first non-error reply it obtains.
If all shards return an error, the client can reply with any one of these.
For example, consider a
<a href="/docs/latest/commands/script-kill/">
<code>
SCRIPT KILL
</code>
</a>
command that's sent to all shards.
Although the script should be loaded in all of the cluster's shards, the
<a href="/docs/latest/commands/script-kill/">
<code>
SCRIPT KILL
</code>
</a>
will typically run only on one at a given time.
</li>
<li>
<strong>
all_succeeded:
</strong>
the client should return successfully only if there are no error replies.
Even a single error reply should disqualify the aggregate and be returned.
Otherwise, the client should return one of the non-error replies.
As an example, consider the
<a href="/docs/latest/commands/config-set/">
<code>
CONFIG SET
</code>
</a>
,
<a href="/docs/latest/commands/script-flush/">
<code>
SCRIPT FLUSH
</code>
</a>
and
<a href="/docs/latest/commands/script-load/">
<code>
SCRIPT LOAD
</code>
</a>
commands.
</li>
<li>
<strong>
agg_logical_and:
</strong>
the client should return the result of a logical
<em>
AND
</em>
operation on all replies (only applies to integer replies, usually from commands that return either
<em>
0
</em>
or
<em>
1
</em>
).
Consider the
<a href="/docs/latest/commands/script-exists/">
<code>
SCRIPT EXISTS
</code>
</a>
command as an example.
It returns an array of
<em>
0
</em>
's and
<em>
1
</em>
's that denote the existence of its given SHA1 sums in the script cache.
The aggregated response should be
<em>
1
</em>
only when all shards had reported that a given script SHA1 sum is in their respective cache.
</li>
<li>
<strong>
agg_logical_or:
</strong>
the client should return the result of a logical
<em>
AND
</em>
operation on all replies (only applies to integer replies, usually from commands that return either
<em>
0
</em>
or
<em>
1
</em>
).
</li>
<li>
<strong>
agg_min:
</strong>
the client should return the minimal value from the replies (only applies to numerical replies).
The aggregate reply from a cluster-wide
<a href="/docs/latest/commands/wait/">
<code>
WAIT
</code>
</a>
command, for example, should be the minimal value (number of synchronized replicas) from all shards.
</li>
<li>
<strong>
agg_max:
</strong>
the client should return the maximal value from the replies (only applies to numerical replies).
</li>
<li>
<strong>
agg_sum:
</strong>
the client should return the sum of replies (only applies to numerical replies).
Example:
<a href="/docs/latest/commands/dbsize/">
<code>
DBSIZE
</code>
</a>
.
</li>
<li>
<strong>
special:
</strong>
this type of tip indicates a non-trivial form of reply policy.
<a href="/docs/latest/commands/info/">
<code>
INFO
</code>
</a>
is an excellent example of that.
</li>
</ul>
<h2 id="example">
Example
</h2>
<pre tabindex="0"><code>redis> command info ping
1) 1) "ping"
2) (integer) -1
3) 1) fast
4) (integer) 0
5) (integer) 0
6) (integer) 0
7) 1) @fast
2) @connection
8) 1) "request_policy:all_shards"
2) "response_policy:all_succeeded"
9) (empty array)
10) (empty array)
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/reference/command-tips/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/waitaof/.html | <section class="prose w-full py-12">
<h1 class="command-name">
WAITAOF
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">WAITAOF numlocal numreplicas timeout</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
7.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@connection
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
This command blocks the current client until all previous write commands by that client are acknowledged as having been fsynced to the AOF of the local Redis and/or at least the specified number of replicas.
</p>
<p>
<code>
numlocal
</code>
represents the number of local fsyncs required to be confirmed before proceeding.
When
<code>
numlocal
</code>
is set to 1, the command blocks until the data written to the Redis instance is confirmed to be persisted to the local AOF file.
The value 0 disables this check.
</p>
<p>
If the timeout, specified in milliseconds, is reached, the command returns even if the specified number of acknowledgments has not been met.
</p>
<p>
The command
<strong>
will always return
</strong>
the number of masters and replicas that have fsynced all write commands sent by the current client before the
<code>
WAITAOF
</code>
command, both in the case where the specified thresholds were met, and when the timeout is reached.
</p>
<p>
A few remarks:
</p>
<ol>
<li>
When
<code>
WAITAOF
</code>
returns, all the previous write commands sent in the context of the current connection are guaranteed to be fsynced to the AOF of at least the number of masters and replicas returned by
<code>
WAITAOF
</code>
.
</li>
<li>
If the command is sent as part of a
<a href="/docs/latest/commands/multi/">
<code>
MULTI
</code>
</a>
transaction (or any other context that does not allow blocking, such as inside scripts), the command does not block but instead returns immediately the number of masters and replicas that fsynced all previous write commands.
</li>
<li>
A timeout of 0 means to block forever.
</li>
<li>
Since
<code>
WAITAOF
</code>
returns the number of fsyncs completed both in case of success and timeout, the client should check that the returned values are equal or greater than the persistence level required.
</li>
<li>
<code>
WAITAOF
</code>
cannot be used on replica instances, and the
<code>
numlocal
</code>
argument cannot be non-zero if the local Redis does not have AOF enabled.
</li>
</ol>
<h2 id="limitations">
Limitations
</h2>
<p>
It is possible to write a module or Lua script that propagate writes to the AOF but not the replication stream.
(For modules, this is done using the
<code>
fmt
</code>
argument to
<code>
RedisModule_Call
</code>
or
<code>
RedisModule_Replicate
</code>
; For Lua scripts, this is achieved using
<code>
redis.set_repl
</code>
.)
</p>
<p>
These features are incompatible with the
<code>
WAITAOF
</code>
command as it is currently implemented, and using them in combination may result in incorrect behavior.
</p>
<h2 id="consistency-and-waitaof">
Consistency and WAITAOF
</h2>
<p>
Note that, similarly to
<a href="/docs/latest/commands/wait/">
<code>
WAIT
</code>
</a>
,
<code>
WAITAOF
</code>
does not make Redis a strongly-consistent store.
Unless waiting for all members of a cluster to fsync writes to disk, data can still be lost during a failover or a Redis restart.
However,
<code>
WAITAOF
</code>
does improve real-world data safety.
</p>
<h2 id="implementation-details">
Implementation details
</h2>
<p>
Since Redis 7.2, Redis tracks and increments the replication offset even when no replicas are configured (as long as AOF exists).
</p>
<p>
In addition, Redis replicas asynchronously ping their master with two replication offsets: the offset they have processed in the replication stream, and the offset they have fsynced to their AOF.
</p>
<p>
Redis remembers, for each client, the replication offset of the produced replication stream when the last write command was executed in the context of that client.
When
<code>
WAITAOF
</code>
is called, Redis checks if the local Redis and/or the specified number of replicas have confirmed fsyncing this offset or a greater one to their AOF.
</p>
<h2 id="examples">
Examples
</h2>
<pre tabindex="0"><code>> SET foo bar
OK
> WAITAOF 1 0 0
1) (integer) 1
2) (integer) 0
> WAITAOF 0 1 1000
1) (integer) 1
2) (integer) 0
</code></pre>
<p>
In the above example, the first call to
<code>
WAITAOF
</code>
does not use a timeout and asks for the write to be fsynced to the local Redis only; it returns with [1, 0] when this is completed.
</p>
<p>
In the second attempt we instead specify a timeout, and ask for the write to be confirmed as fsynced by a single replica.
Since there are no connected replicas, the
<code>
WAITAOF
</code>
command unblocks after one second and again returns [1, 0], indicating the write has been fsynced on the local Redis but no replicas.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<p>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: The command returns an array of two integers:
</p>
<ol>
<li>
The first is the number of local Redises (0 or 1) that have fsynced to AOF all writes performed in the context of the current connection
</li>
<li>
The second is the number of replicas that have acknowledged doing the same.
</li>
</ol>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/waitaof/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/client-list/.html | <section class="prose w-full py-12">
<h1 class="command-name">
CLIENT LIST
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CLIENT LIST [TYPE <NORMAL | MASTER | REPLICA | PUBSUB>]
[ID client-id [client-id ...]]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.4.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of client connections
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@admin
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@dangerous
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@connection
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
The
<code>
CLIENT LIST
</code>
command returns information and statistics about the client
connections server in a mostly human readable format.
</p>
<p>
You can use one of the optional subcommands to filter the list. The
<code>
TYPE type
</code>
subcommand filters the list by clients' type, where
<em>
type
</em>
is one of
<code>
normal
</code>
,
<code>
master
</code>
,
<code>
replica
</code>
, and
<code>
pubsub
</code>
. Note that clients blocked by the
<a href="/docs/latest/commands/monitor/">
<code>
MONITOR
</code>
</a>
command belong to the
<code>
normal
</code>
class.
</p>
<p>
The
<code>
ID
</code>
filter only returns entries for clients with IDs matching the
<code>
client-id
</code>
arguments.
</p>
<p>
Here is the meaning of the fields:
</p>
<ul>
<li>
<code>
id
</code>
: a unique 64-bit client ID
</li>
<li>
<code>
addr
</code>
: address/port of the client
</li>
<li>
<code>
laddr
</code>
: address/port of local address client connected to (bind address)
</li>
<li>
<code>
fd
</code>
: file descriptor corresponding to the socket
</li>
<li>
<code>
name
</code>
: the name set by the client with
<a href="/docs/latest/commands/client-setname/">
<code>
CLIENT SETNAME
</code>
</a>
</li>
<li>
<code>
age
</code>
: total duration of the connection in seconds
</li>
<li>
<code>
idle
</code>
: idle time of the connection in seconds
</li>
<li>
<code>
flags
</code>
: client flags (see below)
</li>
<li>
<code>
db
</code>
: current database ID
</li>
<li>
<code>
sub
</code>
: number of channel subscriptions
</li>
<li>
<code>
psub
</code>
: number of pattern matching subscriptions
</li>
<li>
<code>
ssub
</code>
: number of shard channel subscriptions. Added in Redis 7.0.3
</li>
<li>
<code>
multi
</code>
: number of commands in a MULTI/EXEC context
</li>
<li>
<code>
watch
</code>
: number of keys this client is currently watching. Added in Redis 7.4
</li>
<li>
<code>
qbuf
</code>
: query buffer length (0 means no query pending)
</li>
<li>
<code>
qbuf-free
</code>
: free space of the query buffer (0 means the buffer is full)
</li>
<li>
<code>
argv-mem
</code>
: incomplete arguments for the next command (already extracted from query buffer)
</li>
<li>
<code>
multi-mem
</code>
: memory is used up by buffered multi commands. Added in Redis 7.0
</li>
<li>
<code>
obl
</code>
: output buffer length
</li>
<li>
<code>
oll
</code>
: output list length (replies are queued in this list when the buffer is full)
</li>
<li>
<code>
omem
</code>
: output buffer memory usage
</li>
<li>
<code>
tot-mem
</code>
: total memory consumed by this client in its various buffers
</li>
<li>
<code>
events
</code>
: file descriptor events (see below)
</li>
<li>
<code>
cmd
</code>
: last command played
</li>
<li>
<code>
user
</code>
: the authenticated username of the client
</li>
<li>
<code>
redir
</code>
: client id of current client tracking redirection
</li>
<li>
<code>
resp
</code>
: client RESP protocol version. Added in Redis 7.0
</li>
</ul>
<p>
The client flags can be a combination of:
</p>
<pre tabindex="0"><code>A: connection to be closed ASAP
b: the client is waiting in a blocking operation
c: connection to be closed after writing entire reply
d: a watched keys has been modified - EXEC will fail
e: the client is excluded from the client eviction mechanism
i: the client is waiting for a VM I/O (deprecated)
M: the client is a master
N: no specific flag set
O: the client is a client in MONITOR mode
P: the client is a Pub/Sub subscriber
r: the client is in readonly mode against a cluster node
S: the client is a replica node connection to this instance
u: the client is unblocked
U: the client is connected via a Unix domain socket
x: the client is in a MULTI/EXEC context
t: the client enabled keys tracking in order to perform client side caching
T: the client will not touch the LRU/LFU of the keys it accesses
R: the client tracking target client is invalid
B: the client enabled broadcast tracking mode
</code></pre>
<p>
The file descriptor events can be:
</p>
<pre tabindex="0"><code>r: the client socket is readable (event loop)
w: the client socket is writable (event loop)
</code></pre>
<h2 id="notes">
Notes
</h2>
<p>
New fields are regularly added for debugging purpose. Some could be removed
in the future. A version safe Redis client using this command should parse
the output accordingly (i.e. handling gracefully missing fields, skipping
unknown fields).
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Bulk string reply
</a>
: information and statistics about client connections.
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 2.8.12: Added unique client
<code>
id
</code>
field.
</li>
<li>
Starting with Redis version 5.0.0: Added optional
<code>
TYPE
</code>
filter.
</li>
<li>
Starting with Redis version 6.0.0: Added
<code>
user
</code>
field.
</li>
<li>
Starting with Redis version 6.2.0: Added
<code>
argv-mem
</code>
,
<code>
tot-mem
</code>
,
<code>
laddr
</code>
and
<code>
redir
</code>
fields and the optional
<code>
ID
</code>
filter.
</li>
<li>
Starting with Redis version 7.0.0: Added
<code>
resp
</code>
,
<code>
multi-mem
</code>
,
<code>
rbs
</code>
and
<code>
rbp
</code>
fields.
</li>
<li>
Starting with Redis version 7.0.3: Added
<code>
ssub
</code>
field.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/client-list/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/bdbs/alerts/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Database alerts requests
</h1>
<p class="text-lg -mt-5 mb-10">
Database alert requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-bdbs-alerts">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts
</code>
</td>
<td>
Get all alert states for all databases
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-alerts">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}
</code>
</td>
<td>
Get all alert states for a specific database
</td>
</tr>
<tr>
<td>
<a href="#get-bdbs-alert">
GET
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}/{alert}
</code>
</td>
<td>
Get a specific database alert state
</td>
</tr>
<tr>
<td>
<a href="#post-bdbs-alerts">
POST
</a>
</td>
<td>
<code>
/v1/bdbs/alerts/{uid}
</code>
</td>
<td>
Update a database’s alerts configuration
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-bdbs-alerts">
Get all database alerts
</h2>
<pre><code>GET /v1/bdbs/alerts
</code></pre>
<p>
Get all alert states for all databases.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_all_bdbs_alerts">
view_all_bdbs_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts
</code></pre>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns a hash of alert UIDs and the
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/alert/">
alerts
</a>
states for each database.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-alerts">
Get database alerts
</h2>
<pre><code>GET /v1/bdbs/alerts/{int: uid}
</code></pre>
<p>
Get all alert states for a database.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_bdb_alerts">
view_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request-alerts">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts/1
</code></pre>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h3 id="get-response-alerts">
Response
</h3>
<p>
Returns a hash of
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/alert/">
alert objects
</a>
and their states.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"..."</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes-alerts">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified bdb does not exist
</td>
</tr>
</tbody>
</table>
<h2 id="get-bdbs-alert">
Get database alert
</h2>
<pre><code>GET /v1/bdbs/alerts/{int: uid}/{alert}
</code></pre>
<p>
Get a database alert state.
</p>
<h4 id="required-permissions-2">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#view_bdb_alerts">
view_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-2">
Example HTTP request
</h4>
<pre><code>GET /bdbs/alerts/1/bdb_size
</code></pre>
<h4 id="request-headers-2">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the database
</td>
</tr>
<tr>
<td>
alert
</td>
<td>
string
</td>
<td>
The alert name
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns an
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/alert/">
alert object
</a>
.
</p>
<h4 id="example-json-body-2">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"severity"</span><span class="p">:</span> <span class="s2">"WARNING"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_time"</span><span class="p">:</span> <span class="s2">"2014-08-29T11:19:49Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"change_value"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"state"</span><span class="p">:</span> <span class="kc">true</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span> <span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"memory_util"</span><span class="p">:</span> <span class="mf">81.2</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.1">
400 Bad Request
</a>
</td>
<td>
Bad request
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified alert or bdb does not exist
</td>
</tr>
</tbody>
</table>
<h2 id="post-bdbs-alerts">
Update database alert
</h2>
<pre><code>POST /v1/bdbs/alerts/{int: uid}
</code></pre>
<p>
Updates a database's alerts configuration.
</p>
<h4 id="required-permissions-3">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/permissions/#update_bdb_alerts">
update_bdb_alerts
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="post-request">
Request
</h3>
<p>
If passed with the dry_run URL query string, the function will validate the alert thresholds, but not commit them.
</p>
<h4 id="example-http-request-3">
Example HTTP request
</h4>
<pre><code>POST /bdbs/alerts/1
</code></pre>
<h4 id="example-json-body-3">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_size"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"80"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_syncer_lag"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">""</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">false</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_low_throughput"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_latency"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"3000"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_high_throughput"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"bdb_backup_delayed"</span><span class="p">:{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"threshold"</span><span class="p">:</span><span class="s2">"1800"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"enabled"</span><span class="p">:</span><span class="kc">true</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h4 id="request-headers-3">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters-1">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
Database ID
</td>
</tr>
<tr>
<td>
dry_run
</td>
<td>
string
</td>
<td>
Validate the alert thresholds but do not apply them
</td>
</tr>
</tbody>
</table>
<h4 id="request-body">
Request body
</h4>
<p>
The request must contain a single JSON object with one or many database
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/alert/">
alert objects
</a>
.
</p>
<h3 id="post-response">
Response
</h3>
<p>
The response includes the updated database
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/alert/">
alerts
</a>
.
</p>
<h3 id="post-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Specified database was not found.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
Invalid configuration parameters provided.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success, database alerts updated.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/requests/bdbs/alerts/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/databases/active-active/develop/data-types/json/.html | <section class="prose w-full py-12 max-w-none">
<h1>
JSON in Active-Active databases
</h1>
<p class="text-lg -mt-5 mb-10">
Information about using JSON with an Active-Active database.
</p>
<p>
Active-Active databases support JSON data structures.
</p>
<p>
The design is based on
<a href="https://arxiv.org/abs/1608.03960">
A Conflict-Free Replicated JSON Datatype
</a>
by Kleppmann and Beresford, but the implementation includes some changes. Several
<a href="#conflict-resolution-rules">
conflict resolution rule
</a>
examples were adapted from this paper as well.
</p>
<h2 id="prerequisites">
Prerequisites
</h2>
<p>
To use JSON in an Active-Active database, you must enable JSON during database creation.
</p>
<p>
Active-Active Redis Cloud databases add JSON by default. See
<a href="/docs/latest/operate/rc/databases/create-database/create-active-active-database/#select-capabilities">
Create an Active-Active subscription
</a>
in the Redis Cloud documentation for details.
</p>
<p>
In Redis Enterprise Software, JSON is not enabled by default for Active-Active databases. See
<a href="/docs/latest/operate/oss_and_stack/stack-with-enterprise/json/active-active/#create-an-active-active-json-database">
Create an Active-Active JSON database
</a>
in the Redis Stack and Redis Enterprise documentation for instructions.
</p>
<h2 id="command-differences">
Command differences
</h2>
<p>
Some JSON commands work differently for Active-Active databases.
</p>
<h3 id="jsonclear">
<code>
JSON.CLEAR
</code>
</h3>
<p>
<a href="/docs/latest/commands/json.clear">
<code>
JSON.CLEAR
</code>
</a>
resets JSON arrays and objects. It supports concurrent updates to JSON documents from different instances in an Active-Active database and allows the results to be merged.
</p>
<h2 id="conflict-resolution-rules">
Conflict resolution rules
</h2>
<p>
With Active-Active databases, it's possible for two different instances to try to run write operations on the same data at the same time. If this happens, conflicts can arise when the replicas attempt to sync these changes with each other. Conflict resolution rules determine how the database handles conflicting operations.
</p>
<p>
There are two types of conflict resolution:
</p>
<ol>
<li>
<p>
Merge:
</p>
<ul>
<li>
<p>
The operations are associative.
</p>
</li>
<li>
<p>
Merges the results of both operations.
</p>
</li>
</ul>
</li>
<li>
<p>
Win over:
</p>
<ul>
<li>
<p>
The operations are not associative.
</p>
</li>
<li>
<p>
One operation wins the conflict and sets the value.
</p>
</li>
<li>
<p>
Ignores the losing operation.
</p>
</li>
</ul>
</li>
</ol>
<p>
The following conflict resolution rules show how Active-Active databases resolve conflicts for various JSON commands.
</p>
<h3 id="assign-different-types-to-a-key">
Assign different types to a key
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Two instances concurrently assign values of different types to the same key within a JSON document.
</p>
<p>
For example:
</p>
<p>
Instance 1 assigns an object to a key within a JSON document.
</p>
<p>
Instance 2 assigns an array to the same key.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
The instance with the smaller ID wins, so the key becomes an object in the given example.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
Set the same key to an object or an array
</td>
<td style="text-align:left">
JSON.SET doc $.a '{}'
</td>
<td style="text-align:left">
JSON.SET doc $.a '[]'
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Add data to the object and array
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.a.x '“y”'
</nobr>
<br/>
<br/>
Result:
<br/>
{"a": {"x": "y"}}
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.a '["z"]'
</nobr>
<br/>
<br/>
Result:
<br/>
{“a”: ["z"]}
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"a": {"x": "y"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"a": {"x": "y"}}
</td>
</tr>
</tbody>
</table>
<h3 id="create-versus-create">
Create versus create
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Two instances concurrently use
<code>
JSON.SET
</code>
to assign a new JSON document to the same key.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
The instance with the smaller ID wins.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
Create a new JSON document
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $ '{"field": "a"}'
</nobr>
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $ '{"field": "b"}'
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "a"}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "a"}
</td>
</tr>
</tbody>
</table>
<h3 id="create-versus-update">
Create versus update
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 creates a new document and assigns it to an existing key with
<code>
JSON.SET
</code>
.
</p>
<p>
Instance 2 updates the existing content of the same key with
<code>
JSON.SET
</code>
.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
The operation that creates a new document wins.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value1"}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value1"}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 creates a new document; instance 2 updates the existing document
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $ '{"field2": "value2"}'
</nobr>
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.field1 '[1, 2, 3]'
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc .
<br/>
<br/>
Result:
<br/>
{"field2": "value2"}
</td>
<td style="text-align:left">
JSON.GET doc .
<br/>
<br/>
Result:
<br/>
{"field2": "value2"}
</td>
</tr>
</tbody>
</table>
<h3 id="delete-versus-create">
Delete versus create
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 deletes a JSON document with
<code>
JSON.DEL
</code>
.
</p>
<p>
Instance 2 uses
<code>
JSON.SET
</code>
to create a new JSON document and assign it to the key deleted by instance 1.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Document creation wins over deletion.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value1"}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value1"}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 deletes the document; instance 2 creates a new document
</td>
<td style="text-align:left">
JSON.DEL doc
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $ '{"field1": "value2"}'
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 2 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
<nobr>
{"field1": "value2"}
</nobr>
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value2"}
</td>
</tr>
</tbody>
</table>
<h3 id="delete-versus-update">
Delete versus update
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 deletes a JSON document with
<code>
JSON.DEL
</code>
.
</p>
<p>
Instance 2 updates the content of the same document with
<code>
JSON.SET
</code>
.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Document deletion wins over updates.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
<nobr>
{"field1": "value1"}
</nobr>
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field1": "value1"}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 deletes the document; instance 2 updates it
</td>
<td style="text-align:left">
JSON.DEL doc
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.field1 '[1, 2, 3]'
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
(nil)
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
(nil)
</td>
</tr>
</tbody>
</table>
<h3 id="update-versus-update">
Update versus update
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 updates a field inside a JSON document with
<code>
JSON.SET
</code>
.
</p>
<p>
Instance 2 updates the same field with a different value.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
The instance with the smallest ID wins.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "a"}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "a"}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Update the same field with different data
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.field "b"
</nobr>
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.field "c"
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "b"}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"field": "b"}
</td>
</tr>
</tbody>
</table>
<h3 id="update-versus-clear">
Update versus clear
</h3>
<p>
The version of RedisJSON prior to v2.2 has two different ways to reset the content of a JSON object:
</p>
<ul>
<li>
<p>
Assign a new empty JSON object:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">JSON.SET doc $.colors <span class="s1">'{}'</span>
</span></span></code></pre>
</div>
<p>
If you use this method, it cannot be merged with a concurrent update.
</p>
</li>
<li>
<p>
For each key, remove it with
<code>
JSON.DEL
</code>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">JSON.DEL doc $.colors.blue
</span></span></code></pre>
</div>
<p>
With this method, it can merge the reset with concurrent updates.
</p>
</li>
</ul>
<p>
As of RedisJSON v2.2, you can use the
<code>
JSON.CLEAR
</code>
command to reset the JSON document without removing each key manually. This method also lets concurrent updates be merged.
</p>
<h4 id="assign-an-empty-object">
Assign an empty object
</h4>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 adds "red" to the existing "colors" object with
<code>
JSON.SET
</code>
.
</p>
<p>
Instance 2 assigns a new empty object for "colors".
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Document creation wins over the update, so the result will be an empty object.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff"}}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 adds a new color; instance 2 resets colors to an empty object
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.colors.red ‘#ff0000’
</nobr>
</td>
<td style="text-align:left">
JSON.SET doc $.colors ‘{}’
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Instance 2 adds a new color
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.colors.green ‘#00ff00’
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff", "red": "#ff0000"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"green": "#00ff00"}}
</td>
</tr>
<tr>
<td style="text-align:center">
t5
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t6
</td>
<td style="text-align:left">
Instance 2 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"green": "#00ff00"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"green": "#00ff00"}}
</td>
</tr>
</tbody>
</table>
<h4 id="use-jsonclear">
Use
<code>
JSON.CLEAR
</code>
</h4>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 adds "red" to the existing "colors" object with
<code>
JSON.SET
</code>
.
</p>
<p>
Instance 2 clears the "colors" object with
<code>
JSON.CLEAR
</code>
and adds "green" to "colors".
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Merge
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Merges the results of all operations.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff"}}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 adds a new color; instance 2 resets the colors
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.colors.red ‘#ff0000’
</nobr>
</td>
<td style="text-align:left">
JSON.CLEAR doc $.colors
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"blue": "#0000ff", "red": "#ff0000"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {}}
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Instance 2 adds a new color
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc $.colors.green ‘#00ff00’
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t5
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"green": "#00ff00"}}
</td>
</tr>
<tr>
<td style="text-align:center">
t6
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t7
</td>
<td style="text-align:left">
Merges the results of both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"red": "#ff0000", "green": "#00ff00"}}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"colors": {"red": "#ff0000", "green": "#00ff00"}}
</td>
</tr>
</tbody>
</table>
<h3 id="update-versus-update-array">
Update versus update array
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Two instances update the same existing array with different content.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Merge
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Merges the results of all operations on the array. Preserves the original element order from each instance.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
'["a", "b", "c"]'
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
'["a", "b", "c"]'
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 removes an array element; instance 2 adds one
</td>
<td style="text-align:left">
JSON.ARRPOP doc $ 1
<br/>
<br/>
Result:
<br/>
["a", "c"]
</td>
<td style="text-align:left">
<nobr>
JSON.ARRINSERT doc $ 0 ‘“y”’
</nobr>
<br/>
<br/>
Result:
<br/>
["y", "a", "b", "c"]
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Both instances add another element to the array
</td>
<td style="text-align:left">
<nobr>
JSON.ARRINSERT doc $ 1 ‘“x”’
</nobr>
<br/>
<br/>
Result:
<br/>
["a", "x", "c"]
</td>
<td style="text-align:left">
<nobr>
JSON.ARRINSERT doc $ 2 ‘“z”’
</nobr>
<br/>
<br/>
Result:
<br/>
["y", "a", "z", "b", "c"]
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t5
</td>
<td style="text-align:left">
Merge results from both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
["y", "a", "x", "z", "c"]
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
["y", "a", "x", "z", "c"]
</td>
</tr>
</tbody>
</table>
<h3 id="update-versus-delete-array-element">
Update versus delete array element
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Instance 1 removes an element from a JSON array with
<code>
JSON.ARRPOP
</code>
.
</p>
<p>
Instance 2 updates the same element that instance 1 removes.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Win over
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Deletion wins over updates.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{“todo”: [{“title”: “buy milk”, “done”: false}]}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{“todo”: [{“title”: “buy milk”, “done”: false}]}
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Instance 1 removes an array element; instance 2 updates the same element
</td>
<td style="text-align:left">
<nobr>
JSON.ARRPOP doc $.todo 0
</nobr>
</td>
<td style="text-align:left">
<nobr>
JSON.SET doc '$.todo[0]["done"]' 'true'’
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{“todo”: []}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
[{“title”: “buy milk”, “done”: true}]}
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t5
</td>
<td style="text-align:left">
Instance 1 wins
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
doc = {“todo”: []}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
doc = {“todo”: []}
</td>
</tr>
</tbody>
</table>
<h3 id="update-versus-update-object">
Update versus update object
</h3>
<p>
<strong>
Conflict
</strong>
</p>
<p>
Both instances update the same existing object with different content.
</p>
<p>
<strong>
Resolution type
</strong>
</p>
<p>
Merge
</p>
<p>
<strong>
Resolution rule
</strong>
</p>
<p>
Merges the results of all operations on the object.
</p>
<p>
<strong>
Example
</strong>
</p>
<table>
<thead>
<tr>
<th style="text-align:center">
Time
</th>
<th style="text-align:left">
Description
</th>
<th style="text-align:left">
Instance 1
</th>
<th style="text-align:left">
Instance 2
</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">
t1
</td>
<td style="text-align:left">
The document exists on both instances
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
'{"grocery": []}'
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
'{"grocery": []}'
</td>
</tr>
<tr>
<td style="text-align:center">
t2
</td>
<td style="text-align:left">
Add new elements to the array
</td>
<td style="text-align:left">
<nobr>
JSON.ARRAPPEND doc $.grocery ‘“eggs”’
</nobr>
</td>
<td style="text-align:left">
JSON.ARRAPPEND doc $.grocery ‘“milk”’
</td>
</tr>
<tr>
<td style="text-align:center">
t3
</td>
<td style="text-align:left">
Add new elements to the array
</td>
<td style="text-align:left">
JSON.ARRAPPEND doc $.grocery ‘“ham”’
</td>
<td style="text-align:left">
<nobr>
JSON.ARRAPPEND doc $.grocery ‘“flour”’
</nobr>
</td>
</tr>
<tr>
<td style="text-align:center">
t4
</td>
<td style="text-align:left">
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"grocery":["eggs", "ham"]}
</td>
<td style="text-align:left">
JSON.GET doc $
<br/>
<br/>
Result:
<br/>
{"grocery":["milk", "flour"]}
</td>
</tr>
<tr>
<td style="text-align:center">
t5
</td>
<td style="text-align:left">
Active-Active synchronization
</td>
<td style="text-align:left">
– Sync –
</td>
<td style="text-align:left">
– Sync –
</td>
</tr>
<tr>
<td style="text-align:center">
t6
</td>
<td style="text-align:left">
Merges the results from both instances
</td>
<td style="text-align:left">
JSON.GET doc .
<br/>
<br/>
Result:
<br/>
{"grocery":["eggs","ham","milk", "flour"]}
</td>
<td style="text-align:left">
JSON.GET doc .
<br/>
<br/>
Result:
<br/>
{"grocery":["eggs","ham","milk", "flour" ]}
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/databases/active-active/develop/data-types/json/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/nodes/stats/last/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Latest node stats requests
</h1>
<p class="text-lg -mt-5 mb-10">
Most recent node statistics requests
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-all-nodes-stats-last">
GET
</a>
</td>
<td>
<code>
/v1/nodes/stats/last
</code>
</td>
<td>
Get latest stats for all nodes
</td>
</tr>
<tr>
<td>
<a href="#get-node-stats-last">
GET
</a>
</td>
<td>
<code>
/v1/nodes/stats/last/{uid}
</code>
</td>
<td>
Get latest stats for a single node
</td>
</tr>
</tbody>
</table>
<h2 id="get-all-nodes-stats-last">
Get latest stats for all nodes
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/stats/last
</span></span></code></pre>
</div>
<p>
Get latest statistics for all nodes.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_all_nodes_stats">
view_all_nodes_stats
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /nodes/stats/last?interval<span class="o">=</span>1sec<span class="p">&</span><span class="nv">stime</span><span class="o">=</span>2015-10-14T06:29:43Z
</span></span></code></pre>
</div>
<h4 id="request-headers">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week. Default: 1sec. (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
End time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-all-response">
Response
</h3>
<p>
Returns most recent
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for all nodes.
</p>
<h4 id="example-json-body">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_idle"</span><span class="p">:</span> <span class="mf">0.922500000015134</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_system"</span><span class="p">:</span> <span class="mf">0.007499999999708962</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_user"</span><span class="p">:</span> <span class="mf">0.01749999999810825</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cur_aof_rewrites"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"egress_bytes"</span><span class="p">:</span> <span class="mf">7887.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ephemeral_storage_avail"</span><span class="p">:</span> <span class="mf">75821363200.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ephemeral_storage_free"</span><span class="p">:</span> <span class="mf">81189969920.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-10-14T06:29:44Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_memory"</span><span class="p">:</span> <span class="mf">2956963840.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mf">4950.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"persistent_storage_avail"</span><span class="p">:</span> <span class="mf">75821363200.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"persistent_storage_free"</span><span class="p">:</span> <span class="mf">81189969920.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-10-14T06:29:43Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span>
</span></span><span class="line"><span class="cl"> <span class="p">},</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"2"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_idle"</span><span class="p">:</span> <span class="mf">0.922500000015134</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"// additional fields..."</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-all-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
No nodes exist
</td>
</tr>
</tbody>
</table>
<h2 id="get-node-stats-last">
Get latest node stats
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /v1/nodes/stats/last/<span class="o">{</span>int: uid<span class="o">}</span>
</span></span></code></pre>
</div>
<p>
Get the latest statistics of a node.
</p>
<h4 id="required-permissions-1">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_node_stats">
view_node_stats
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request-1">
Example HTTP request
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">GET /nodes/stats/last/1?interval<span class="o">=</span>1sec<span class="p">&</span><span class="nv">stime</span><span class="o">=</span>2015-10-13T09:01:54Z
</span></span></code></pre>
</div>
<h4 id="request-headers-1">
Request headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Host
</td>
<td>
cnm.cluster.fqdn
</td>
<td>
Domain name
</td>
</tr>
<tr>
<td>
Accept
</td>
<td>
application/json
</td>
<td>
Accepted media type
</td>
</tr>
</tbody>
</table>
<h4 id="url-parameters">
URL parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
uid
</td>
<td>
integer
</td>
<td>
The unique ID of the node requested.
</td>
</tr>
</tbody>
</table>
<h4 id="query-parameters-1">
Query parameters
</h4>
<table>
<thead>
<tr>
<th>
Field
</th>
<th>
Type
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
interval
</td>
<td>
string
</td>
<td>
Time interval for which we want stats: 1sec/10sec/5min/15min/1hour/12hour/1week. Default: 1sec. (optional)
</td>
</tr>
<tr>
<td>
stime
</td>
<td>
ISO_8601
</td>
<td>
Start time from which we want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
<tr>
<td>
etime
</td>
<td>
ISO_8601
</td>
<td>
End time after which we don't want the stats. Should comply with the
<a href="https://en.wikipedia.org/wiki/ISO_8601">
ISO_8601
</a>
format (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="get-response">
Response
</h3>
<p>
Returns the most recent
<a href="/docs/latest/operate/rs/references/rest-api/objects/statistics/">
statistics
</a>
for the specified node.
</p>
<h4 id="example-json-body-1">
Example JSON body
</h4>
<div class="highlight">
<pre class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"1"</span><span class="p">:</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"conns"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_idle"</span><span class="p">:</span> <span class="mf">0.8049999999930151</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_system"</span><span class="p">:</span> <span class="mf">0.02750000000014552</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cpu_user"</span><span class="p">:</span> <span class="mf">0.12000000000080036</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"cur_aof_rewrites"</span><span class="p">:</span> <span class="mf">0.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"egress_bytes"</span><span class="p">:</span> <span class="mf">2169.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ephemeral_storage_avail"</span><span class="p">:</span> <span class="mf">75920293888.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ephemeral_storage_free"</span><span class="p">:</span> <span class="mf">81288900608.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"etime"</span><span class="p">:</span> <span class="s2">"2015-10-13T09:01:55Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"free_memory"</span><span class="p">:</span> <span class="mf">3285381120.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"ingress_bytes"</span><span class="p">:</span> <span class="mf">3020.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"interval"</span><span class="p">:</span> <span class="s2">"1sec"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"persistent_storage_avail"</span><span class="p">:</span> <span class="mf">75920293888.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"persistent_storage_free"</span><span class="p">:</span> <span class="mf">81288900608.0</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"stime"</span><span class="p">:</span> <span class="s2">"2015-10-13T09:01:54Z"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="nt">"total_req"</span><span class="p">:</span> <span class="mf">0.0</span>
</span></span><span class="line"><span class="cl"> <span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span></code></pre>
</div>
<h3 id="get-error-codes">
Error codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
No error
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.5">
404 Not Found
</a>
</td>
<td>
Node does not exist
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.7">
406 Not Acceptable
</a>
</td>
<td>
Node isn't currently active
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4">
503 Service Unavailable
</a>
</td>
<td>
Mode is in recovery state
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/nodes/stats/last/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/hrandfield/.html | <section class="prose w-full py-12">
<h1 class="command-name">
HRANDFIELD
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">HRANDFIELD key [count [WITHVALUES]]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
6.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of fields returned
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@hash
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
When called with just the
<code>
key
</code>
argument, return a random field from the hash value stored at
<code>
key
</code>
.
</p>
<p>
If the provided
<code>
count
</code>
argument is positive, return an array of
<strong>
distinct fields
</strong>
.
The array's length is either
<code>
count
</code>
or the hash's number of fields (
<a href="/docs/latest/commands/hlen/">
<code>
HLEN
</code>
</a>
), whichever is lower.
</p>
<p>
If called with a negative
<code>
count
</code>
, the behavior changes and the command is allowed to return the
<strong>
same field multiple times
</strong>
.
In this case, the number of returned fields is the absolute value of the specified
<code>
count
</code>
.
</p>
<p>
The optional
<code>
WITHVALUES
</code>
modifier changes the reply so it includes the respective values of the randomly selected hash fields.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> HSET coin heads obverse tails reverse edge null
(integer) 3
redis> HRANDFIELD coin
"edge"
redis> HRANDFIELD coin
"heads"
redis> HRANDFIELD coin -5 WITHVALUES
1) "tails"
2) "reverse"
3) "tails"
4) "reverse"
5) "heads"
6) "obverse"
7) "edge"
8) "null"
9) "edge"
10) "null"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="specification-of-the-behavior-when-count-is-passed">
Specification of the behavior when count is passed
</h2>
<p>
When the
<code>
count
</code>
argument is a positive value this command behaves as follows:
</p>
<ul>
<li>
No repeated fields are returned.
</li>
<li>
If
<code>
count
</code>
is bigger than the number of fields in the hash, the command will only return the whole hash without additional fields.
</li>
<li>
The order of fields in the reply is not truly random, so it is up to the client to shuffle them if needed.
</li>
</ul>
<p>
When the
<code>
count
</code>
is a negative value, the behavior changes as follows:
</p>
<ul>
<li>
Repeating fields are possible.
</li>
<li>
Exactly
<code>
count
</code>
fields, or an empty array if the hash is empty (non-existing key), are always returned.
</li>
<li>
The order of fields in the reply is truly random.
</li>
</ul>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<p>
Any of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Nil reply
</a>
: if the key doesn't exist
</li>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Bulk string reply
</a>
: a single, randomly selected field when the
<code>
count
</code>
option is not used
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list containing
<code>
count
</code>
fields when the
<code>
count
</code>
option is used, or an empty array if the key does not exists.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of fields and their values when
<code>
count
</code>
and
<code>
WITHVALUES
</code>
were both used.
</li>
</ul>
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<p>
Any of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#nulls">
Null reply
</a>
: if the key doesn't exist
</li>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Bulk string reply
</a>
: a single, randomly selected field when the
<code>
count
</code>
option is not used
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list containing
<code>
count
</code>
fields when the
<code>
count
</code>
option is used, or an empty array if the key does not exists.
</li>
<li>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of fields and their values when
<code>
count
</code>
and
<code>
WITHVALUES
</code>
were both used.
</li>
</ul>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/hrandfield/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/accounts/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage accounts and settings
</h1>
<p class="text-lg -mt-5 mb-10">
Describes how to work with Redis Cloud accounts and manage their settings.
</p>
<p>
Here, you learn how to manage Redis Cloud accounts and their settings:
</p>
<ul>
<li>
<p>
<a href="/docs/latest/operate/rc/accounts/account-settings/">
Manage account settings
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rc/accounts/user-profile/">
Manage user account and profile
</a>
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rc/accounts/user-profile/#switch-redis-cloud-accounts">
Switch between Redis Cloud accounts
</a>
</p>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/accounts/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/security/encryption/internode-encryption/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Internode encryption
</h1>
<p class="text-lg -mt-5 mb-10">
Describes internode encryption which improves the security of data in transit.
</p>
<p>
As of v6.2.4, Redis Enterprise Software supports
<em>
internode encryption
</em>
, which encrypts internal communication between nodes. This improves the security of data as it travels within a cluster.
</p>
<p>
Internode encryption is enabled for the
<em>
control plane
</em>
, which manages the cluster and its databases.
</p>
<p>
Internode encryption is supported for the
<em>
data plane
</em>
, which encrypts communication used to replicate shards between nodes and proxy communication with shards located on different nodes.
</p>
<p>
The following diagram shows how this works.
</p>
<a href="/docs/latest/images/rs/internode-encryption.png" sdata-lightbox="/images/rs/internode-encryption.png">
<img alt="A diagram showing the interaction between data internode encryption, control plane encryption, and various elements of a cluster." src="/docs/latest/images/rs/internode-encryption.png"/>
</a>
<p>
Data internode encryption is disabled by default for individual databases in order to optimize for performance. Encryption adds latency and overhead; the impact is measurable and varies according to the database, its field types, and the details of the underlying use case.
</p>
<p>
You can enable data internode encryption for a database by changing the database configuration settings. This lets you choose when to favor performance and when to encrypt data.
</p>
<h2 id="prerequisites">
Prerequisites
</h2>
<p>
Internode encryption requires certain prerequisites.
</p>
<p>
You need to:
</p>
<ul>
<li>
<p>
Upgrade all nodes in the cluster to v6.2.4 or later.
</p>
</li>
<li>
<p>
Open port 3342 for the TLS channel used for encrypted communication.
</p>
</li>
</ul>
<h2 id="enable-data-internode-encryption">
Enable data internode encryption
</h2>
<p>
To enable internode encryption for a database (also called
<em>
data internode encryption
</em>
), you need to enable the appropriate setting for each database you wish to encrypt. To do so, you can:
</p>
<ul>
<li>
<p>
Use the Cluster Manager UI to enable the
<strong>
Internode Encryption
</strong>
setting from the database
<strong>
Security
</strong>
screen.
</p>
</li>
<li>
<p>
Use the
<code>
rladmin
</code>
command-line utility to set the
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-db">
data_internode_encryption
</a>
setting for the database:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">rladmin tune db <database_id> data_internode_encryption enabled
</span></span></code></pre>
</div>
</li>
<li>
<p>
Use the Redis Enterprise Software REST API to set the
<code>
data_internode_encryption
</code>
setting for the database.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-rest" data-lang="rest"><span class="line"><span class="cl">put /v1/bdbs/${database_id}<span class="err">
</span></span></span><span class="line"><span class="cl"><span class="err"></span>{ “data_internode_encryption” : true }<span class="err">
</span></span></span></code></pre>
</div>
</li>
</ul>
<p>
When you change the data internode encryption setting for a database, all active remote client connections are disconnected. This restarts the internal (DMC) proxy and disconnects all client connections.
</p>
<h2 id="change-cluster-policy">
Change cluster policy
</h2>
<p>
To enable internode encryption for new databases by default, use one of the following methods:
</p>
<ul>
<li>
<p>
Cluster Manager UI
</p>
<ol>
<li>
<p>
On the
<strong>
Databases
</strong>
screen, select
<a href="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" sdata-lightbox="/images/rs/buttons/button-toggle-actions-vertical.png#no-click">
<img alt="Toggle actions button" class="inline" src="/docs/latest/images/rs/buttons/button-toggle-actions-vertical.png#no-click" width="22px"/>
</a>
to open a list of additional actions.
</p>
</li>
<li>
<p>
Select
<strong>
Database defaults
</strong>
.
</p>
</li>
<li>
<p>
Go to
<strong>
Internode Encryption
</strong>
and click
<strong>
Change
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
Enabled
</strong>
to enable internode encryption for new databases by default.
</p>
</li>
<li>
<p>
Click
<strong>
Change
</strong>
.
</p>
</li>
<li>
<p>
Select
<strong>
Save
</strong>
.
</p>
</li>
</ol>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/tune/#tune-cluster">
rladmin tune cluster
</a>
:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin tune cluster data_internode_encryption enabled
</span></span></code></pre>
</div>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/references/rest-api/requests/cluster/policy/#put-cluster-policy">
Update cluster policy
</a>
REST API request:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">PUT /v1/cluster/policy
</span></span><span class="line"><span class="cl"><span class="o">{</span> <span class="s2">"data_internode_encryption"</span>: <span class="nb">true</span> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ul>
<h2 id="encryption-ciphers-and-settings">
Encryption ciphers and settings
</h2>
<p>
To encrypt internode communications, Redis Enterprise Software uses TLS 1.2 and the following cipher suites:
</p>
<ul>
<li>
ECDHE-RSA-AES256-GCM-SHA384
</li>
<li>
ECDHE-RSA-AES128-GCM-SHA256
</li>
</ul>
<p>
As of Redis Enterprise Software v7.4, internode encryption also supports TLS 1.3 with the following cipher suites:
</p>
<ul>
<li>
TLS_AES_128_GCM_SHA256
</li>
<li>
TLS_AES_256_GCM_SHA384
</li>
</ul>
<p>
The TLS layer determines which TLS version to use.
</p>
<p>
No configurable settings are exposed; internode encryption is used internally within a cluster and not exposed to any outside service.
</p>
<h2 id="certificate-authority-and-rotation">
Certificate authority and rotation
</h2>
<p>
Starting with v6.2.4, internode communication is managed, in part, by two certificates: one for the control plane and one for the data plane. These certificates are signed by a private certificate authority (CA). The CA is not exposed outside of the cluster, so it cannot be accessed by external processes or services. In addition, each cluster generates a unique CA that is not used anywhere else.
</p>
<p>
The private CA is generated when a cluster is created or upgraded to 6.2.4.
</p>
<p>
When nodes join the cluster, the cluster CA is used to generate certificates for the new node, one for each plane. Certificates signed by the private CA are not shared between clusters and they're not exposed outside the cluster.
</p>
<p>
All certificates signed by the internal CA expire after ninety (90) days and automatically rotate every thirty (30) days. Alerts also monitor certificate expiration and trigger when certificate expiration falls below 45 days. If you receive such an alert, contact support.
</p>
<p>
You can use the Redis Enterprise Software REST API to rotate certificates manually:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-rest" data-lang="rest"><span class="line"><span class="cl">POST /v1/cluster/certificates/rotate<span class="err">
</span></span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/security/encryption/internode-encryption/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/security/access-control/ldap/update-database-acls/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Update database ACLs
</h1>
<p class="text-lg -mt-5 mb-10">
Describes how to use the Cluster Manager UI to update database access control lists (ACLs) to authorize access to roles authorizing LDAP user access.
</p>
<p>
To grant LDAP users access to a database, assign the mapped access role to the access control list (ACL) for the database.
</p>
<ol>
<li>
<p>
In the Cluster Manager UI, go to
<strong>
Databases
</strong>
, then select the database from the list.
</p>
</li>
<li>
<p>
From the
<strong>
Security
</strong>
tab, select the
<strong>
Edit
</strong>
button.
</p>
</li>
<li>
<p>
In the
<strong>
Access Control List
</strong>
section, select
<strong>
+ Add ACL
</strong>
.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/security-access-control-acl-only.png" sdata-lightbox="/images/rs/screenshots/databases/security-access-control-acl-only.png">
<img alt="Updating a database access control list (ACL)" src="/docs/latest/images/rs/screenshots/databases/security-access-control-acl-only.png"/>
</a>
</li>
<li>
<p>
Select the appropriate roles and then save your changes.
</p>
</li>
</ol>
<p>
If you assign multiple roles to an ACL and a user is authorized by more than one of these roles, their access is determined by the first “matching” rule in the list.
</p>
<p>
If the first rule gives them read access and the third rule authorizes write access, the user will only be able to read data.
</p>
<p>
As a result, we recommend ordering roles so that higher access roles appear before roles with more limited access.
</p>
<h2 id="more-info">
More info
</h2>
<ul>
<li>
Enable and configure
<a href="/docs/latest/operate/rs/security/access-control/ldap/enable-role-based-ldap/">
role-based LDAP
</a>
</li>
<li>
Map LDAP groups to
<a href="/docs/latest/operate/rs/security/access-control/ldap/map-ldap-groups-to-roles/">
access control roles
</a>
</li>
<li>
Learn more about Redis Enterprise Software
<a href="/docs/latest/operate/rs/security/">
security and practices
</a>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/security/access-control/ldap/update-database-acls/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/installing-upgrading/upgrading/upgrade-database/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Upgrade a Redis Enterprise Software database
</h1>
<p class="text-lg -mt-5 mb-10">
Upgrade a Redis Enterprise Software database.
</p>
<h2 id="default-db-versions">
Default Redis database versions
</h2>
<p>
When you upgrade an existing database, it uses the latest bundled Redis version unless you specify a different version with the
<code>
redis_version
</code>
option in the
<a href="/docs/latest/operate/rs/references/rest-api/requests/bdbs/">
REST API
</a>
or
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/upgrade/#upgrade-db">
<code>
rladmin upgrade db
</code>
</a>
.
</p>
<p>
Redis Enterprise Software v6.x includes two Redis database versions: 6.0 and 6.2.
As of version 7.2, Redis Enterprise Software includes three Redis database versions.
</p>
<p>
To view available Redis database versions:
</p>
<ul>
<li>
<p>
In the Cluster Manager UI, see
<strong>
Redis database versions
</strong>
on the
<strong>
Cluster > Configuration
</strong>
screen.
</p>
</li>
<li>
<p>
Send a
<a href="/docs/latest/operate/rs/references/rest-api/requests/nodes/">
<code>
GET /nodes
</code>
REST API request
</a>
and see
<code>
supported_database_versions
</code>
in the response.
</p>
</li>
</ul>
<p>
The default Redis database version differs between Redis Enterprise releases as follows:
</p>
<table>
<thead>
<tr>
<th>
Redis
<br/>
Software
</th>
<th>
Bundled Redis
<br/>
DB versions
</th>
<th>
Default DB version
<br/>
(upgraded/new databases)
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
7.8.2
</td>
<td>
6.2, 7.2, 7.4
</td>
<td>
7.4
</td>
</tr>
<tr>
<td>
7.4.x
</td>
<td>
6.0, 6.2, 7.2
</td>
<td>
7.2
</td>
</tr>
<tr>
<td>
7.2.4
</td>
<td>
6.0, 6.2, 7.2
</td>
<td>
7.2
</td>
</tr>
<tr>
<td>
6.4.2
</td>
<td>
6.0, 6.2
</td>
<td>
6.2
</td>
</tr>
<tr>
<td>
6.2.x
</td>
<td>
6.0, 6.2
</td>
<td>
6.0
</td>
</tr>
</tbody>
</table>
<p>
The upgrade policy is only relevant for Redis Enterprise Software versions 6.2.4 through 6.2.18. For more information about upgrade policies, see the
<a href="https://docs.redis.com/6.2/rs/installing-upgrading/upgrading/#redis-upgrade-policy">
6.2 version of this document
</a>
.
</p>
<h2 id="upgrade-prerequisites">
Upgrade prerequisites
</h2>
<p>
Before upgrading a database:
</p>
<ul>
<li>
<p>
Review the relevant
<a href="/docs/latest/operate/rs/release-notes/">
release notes
</a>
for any preparation instructions.
</p>
</li>
<li>
<p>
Verify that the database version meets the minimums specified earlier.
</p>
<p>
To determine the database version:
</p>
<ul>
<li>
<p>
Use the Cluster Manager UI to open the
<strong>
Configuration
</strong>
tab for the database and select
<a href="/docs/latest/images/rs/icons/info-icon.png#no-click" sdata-lightbox="/images/rs/icons/info-icon.png#no-click">
<img alt="The About database button" class="inline" src="/docs/latest/images/rs/icons/info-icon.png#no-click" width="18px"/>
</a>
<strong>
About
</strong>
.
</p>
</li>
<li>
<p>
<em>
(Optional)
</em>
Use the
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/">
<code>
rladmin status extra all
</code>
</a>
command to display configuration details:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status extra all
</span></span></code></pre>
</div>
<p>
When the database compatibility version is outdated,
<nobr>
<code>
OLD REDIS VERSION
</code>
</nobr>
appears in the command output.
</p>
</li>
</ul>
</li>
<li>
<p>
Verify the cluster is fully upgraded and operational.
</p>
<p>
Use the Cluster Manager UI to display the
<strong>
Configuration
</strong>
tab for the cluster. The tab displays the cluster version information and the Redis database compatibility version.
</p>
</li>
<li>
<p>
Check client compatibility with the database version.
</p>
<p>
If you run Redis Stack commands with Go-Redis versions 9 and later or Lettuce versions 6 and later, set the client’s protocol version to RESP2 before upgrading your database to Redis version 7.2 to prevent potential application issues due to RESP3 breaking changes. See
<a href="/docs/latest/operate/rs/references/compatibility/resp/#client-prerequisites-for-redis-72-upgrade">
Client prerequisites for Redis 7.2 upgrade
</a>
for more details and examples.
</p>
</li>
<li>
<p>
To avoid data loss during the upgrade,
<a href="/docs/latest/operate/rs/databases/import-export/schedule-backups/">
back up your data
</a>
.
</p>
<p>
You can
<a href="/docs/latest/operate/rs/databases/import-export/export-data/">
export the data
</a>
to an external location,
<a href="/docs/latest/operate/rs/databases/durability-ha/replication/">
enable replication
</a>
, or
<a href="/docs/latest/operate/rs/databases/configure/database-persistence/">
enable persistence
</a>
.
</p>
<p>
When choosing how to back up data, keep the following in mind:
</p>
<ul>
<li>
<p>
To reduce downtime when replication is enabled, a failover is performed before restarting the primary (master) database.
</p>
</li>
<li>
<p>
When persistence is enabled without replication, the database is unavailable during restart because the data is restored from the persistence file. AOF persistence restoration is slower than snapshot restoration.
</p>
</li>
</ul>
</li>
</ul>
<h2 id="upgrade-database">
Upgrade database
</h2>
<p>
To upgrade a database:
</p>
<ol>
<li>
<p>
<em>
(Optional)
</em>
Back up the database to minimize the risk of data loss.
</p>
</li>
<li>
<p>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/upgrade/">
<code>
rladmin
</code>
</a>
to upgrade the database. During the upgrade process, the database will restart without losing any data.
</p>
<ul>
<li>
<p>
To upgrade a database and its modules:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">rladmin upgrade db <database name <span class="p">|</span> database ID>
</span></span></code></pre>
</div>
<p>
Example of a successful upgrade:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-shell" data-lang="shell"><span class="line"><span class="cl">rladmin> upgrade db demo
</span></span><span class="line"><span class="cl">Monitoring d194c4a3-631c-4726-b799-331b399fc85c
</span></span><span class="line"><span class="cl">active - SMUpgradeBDB init
</span></span><span class="line"><span class="cl">active - SMUpgradeBDB wait_for_version
</span></span><span class="line"><span class="cl">active - SMUpgradeBDB configure_shards
</span></span><span class="line"><span class="cl">completed - SMUpgradeBDB
</span></span><span class="line"><span class="cl">Done
</span></span></code></pre>
</div>
</li>
<li>
<p>
To upgrade the database to a version other than the default version, use the
<code>
redis_version
</code>
parameter:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin upgrade db <database name <span class="p">|</span> database ID> redis_version <version>
</span></span></code></pre>
</div>
</li>
</ul>
</li>
<li>
<p>
Check the Redis database compatibility version for the database to confirm the upgrade.
</p>
<p>
To do so:
</p>
<ul>
<li>
<p>
Use the Cluster Manager UI to open the
<strong>
Configuration
</strong>
tab for the database and select
<a href="/docs/latest/images/rs/icons/info-icon.png#no-click" sdata-lightbox="/images/rs/icons/info-icon.png#no-click">
<img alt="The About database button" class="inline" src="/docs/latest/images/rs/icons/info-icon.png#no-click" width="18px"/>
</a>
<strong>
About
</strong>
.
</p>
</li>
<li>
<p>
Use
<a href="/docs/latest/operate/rs/references/cli-utilities/rladmin/status/#status-databases">
<code>
rladmin status databases extra all
</code>
</a>
to display a list of the databases in your cluster and their current Redis database compatibility version:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin status databases extra all
</span></span></code></pre>
</div>
</li>
</ul>
<p>
Verify that the Redis version is set to the expected value.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/installing-upgrading/upgrading/upgrade-database/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/requests/cluster/debuginfo/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Cluster debug info requests
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the Redis Enterprise Software REST API /cluster/debuginfo requests.
</p>
<table>
<thead>
<tr>
<th>
Method
</th>
<th>
Path
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="#get-cluster-debuginfo">
GET
</a>
</td>
<td>
<code>
/v1/cluster/debuginfo
</code>
</td>
<td>
Get debug info from all nodes and databases
</td>
</tr>
</tbody>
</table>
<h2 id="get-cluster-debuginfo">
Get cluster debug info
</h2>
<pre><code>GET /v1/cluster/debuginfo
</code></pre>
<p>
Downloads a tar file that contains debug info from all nodes and databases.
</p>
<h4 id="required-permissions">
Required permissions
</h4>
<table>
<thead>
<tr>
<th>
Permission name
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="/docs/latest/operate/rs/references/rest-api/permissions/#view_debugging_info">
view_debugging_info
</a>
</td>
</tr>
</tbody>
</table>
<h3 id="get-request">
Request
</h3>
<h4 id="example-http-request">
Example HTTP request
</h4>
<pre><code>GET /cluster/debuginfo
</code></pre>
<h3 id="get-response">
Response
</h3>
<p>
Downloads the debug info in a tar file called
<code>
filename.tar.gz
</code>
. Extract the files from the tar file to access the debug info for all nodes.
</p>
<h4 id="response-headers">
Response headers
</h4>
<table>
<thead>
<tr>
<th>
Key
</th>
<th>
Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Content-Type
</td>
<td>
application/x-gzip
</td>
<td>
Media type of request/response body
</td>
</tr>
<tr>
<td>
Content-Length
</td>
<td>
653350
</td>
<td>
Length of the response body in octets
</td>
</tr>
<tr>
<td>
Content-Disposition
</td>
<td>
attachment; filename=debuginfo.tar.gz
</td>
<td>
Display response in browser or download as attachment
</td>
</tr>
</tbody>
</table>
<h3 id="get-status-codes">
Status codes
</h3>
<table>
<thead>
<tr>
<th>
Code
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.1">
200 OK
</a>
</td>
<td>
Success.
</td>
</tr>
<tr>
<td>
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.1">
500 Internal Server Error
</a>
</td>
<td>
Failed to get debug info.
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/requests/cluster/debuginfo/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/ts.mget/.html | <section class="prose w-full py-12">
<h1 class="command-name">
TS.MGET
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TS.MGET [LATEST] [WITHLABELS | <SELECTED_LABELS label...>] FILTER filterExpr...
</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/timeseries">
TimeSeries 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(n) where n is the number of time-series that match the filters
</dd>
</dl>
<p>
Get the sample with the highest timestamp from each time series matching a specific filter
</p>
<p>
<a href="#examples">
Examples
</a>
</p>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
FILTER filterExpr...
</code>
</summary>
<p>
filters time series based on their labels and label values. Each filter expression has one of the following syntaxes:
</p>
<ul>
<li>
<code>
label!=
</code>
- the time series has a label named
<code>
label
</code>
</li>
<li>
<code>
label=value
</code>
- the time series has a label named
<code>
label
</code>
with a value equal to
<code>
value
</code>
</li>
<li>
<code>
label=(value1,value2,...)
</code>
- the time series has a label named
<code>
label
</code>
with a value equal to one of the values in the list
</li>
<li>
<code>
label=
</code>
- the time series does not have a label named
<code>
label
</code>
</li>
<li>
<code>
label!=value
</code>
- the time series does not have a label named
<code>
label
</code>
with a value equal to
<code>
value
</code>
</li>
<li>
<code>
label!=(value1,value2,...)
</code>
- the time series does not have a label named
<code>
label
</code>
with a value equal to any of the values in the list
</li>
</ul>
<p>
<note>
<b>
Notes:
</b>
</note>
</p>
<ul>
<li>
At least one filter expression with a syntax
<code>
label=value
</code>
or
<code>
label=(value1,value2,...)
</code>
is required.
</li>
<li>
Filter expressions are conjunctive. For example, the filter
<code>
type=temperature room=study
</code>
means that a time series is a temperature time series of a study room.
</li>
<li>
Whitespaces are unallowed in a filter expression except between quotes or double quotes in values - e.g.,
<code>
x="y y"
</code>
or
<code>
x='(y y,z z)'
</code>
.
</li>
</ul>
</details>
<h2 id="optional-arguments">
Optional arguments
</h2>
<details open="">
<summary>
<code>
LATEST
</code>
(since RedisTimeSeries v1.8)
</summary>
<p>
is used when a time series is a compaction. With
<code>
LATEST
</code>
, TS.MGET also reports the compacted value of the latest (possibly partial) bucket, given that this bucket's start time falls within
<code>
[fromTimestamp, toTimestamp]
</code>
. Without
<code>
LATEST
</code>
, TS.MGET does not report the latest (possibly partial) bucket. When a time series is not a compaction,
<code>
LATEST
</code>
is ignored.
</p>
<p>
The data in the latest bucket of a compaction is possibly partial. A bucket is
<em>
closed
</em>
and compacted only upon the arrival of a new sample that
<em>
opens
</em>
a new
<em>
latest
</em>
bucket. There are cases, however, when the compacted value of the latest (possibly partial) bucket is also required. In such a case, use
<code>
LATEST
</code>
.
</p>
</details>
<details open="">
<summary>
<code>
WITHLABELS
</code>
</summary>
<p>
includes in the reply all label-value pairs representing metadata labels of the time series.
If
<code>
WITHLABELS
</code>
or
<code>
SELECTED_LABELS
</code>
are not specified, by default, an empty list is reported as label-value pairs.
</p>
</details>
<details open="">
<summary>
<code>
SELECTED_LABELS label...
</code>
(since RedisTimeSeries v1.6)
</summary>
<p>
returns a subset of the label-value pairs that represent metadata labels of the time series.
Use when a large number of labels exists per series, but only the values of some of the labels are required.
If
<code>
WITHLABELS
</code>
or
<code>
SELECTED_LABELS
</code>
are not specified, by default, an empty list is reported as label-value pairs.
</p>
</details>
<p>
<note>
<b>
Note:
</b>
The
<a href="/docs/latest/commands/mget/">
<code>
MGET
</code>
</a>
command cannot be part of a transaction when running on a Redis cluster.
</note>
</p>
<h2 id="return-value">
Return value
</h2>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
: for each time series matching the specified filters, the following is reported:
<ul>
<li>
bulk-string-reply: The time series key name
</li>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
: label-value pairs (
<a href="/docs/latest/develop/reference/protocol-spec/#bulk-strings">
Bulk string reply
</a>
,
<a href="/docs/latest/develop/reference/protocol-spec/#bulk-strings">
Bulk string reply
</a>
)
<ul>
<li>
By default, an empty array is reported
</li>
<li>
If
<code>
WITHLABELS
</code>
is specified, all labels associated with this time series are reported
</li>
<li>
If
<code>
SELECTED_LABELS label...
</code>
is specified, the selected labels are reported (null value when no such label defined)
</li>
</ul>
</li>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
: a single timestamp-value pair (
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
,
<a href="/docs/latest/develop/reference/protocol-spec/#simple-strings">
Simple string reply
</a>
(double))
</li>
</ul>
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<details open="">
<summary>
<b>
Select labels to retrieve
</b>
</summary>
<p>
Create time series for temperature in Tel Aviv and Jerusalem, then add different temperature samples.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> TS.CREATE temp:TLV LABELS <span class="nb">type</span> temp location TLV
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TS.CREATE temp:JLM LABELS <span class="nb">type</span> temp location JLM
</span></span><span class="line"><span class="cl">OK
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TS.MADD temp:TLV <span class="m">1000</span> <span class="m">30</span> temp:TLV <span class="m">1010</span> <span class="m">35</span> temp:TLV <span class="m">1020</span> <span class="m">9999</span> temp:TLV <span class="m">1030</span> <span class="m">40</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1000</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1010</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1020</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1030</span>
</span></span><span class="line"><span class="cl">127.0.0.1:6379> TS.MADD temp:JLM <span class="m">1005</span> <span class="m">30</span> temp:JLM <span class="m">1015</span> <span class="m">35</span> temp:JLM <span class="m">1025</span> <span class="m">9999</span> temp:JLM <span class="m">1035</span> <span class="m">40</span>
</span></span><span class="line"><span class="cl">1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1005</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1015</span>
</span></span><span class="line"><span class="cl">3<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1025</span>
</span></span><span class="line"><span class="cl">4<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1035</span></span></span></code></pre>
</div>
<p>
Get all the labels associated with the last sample.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> TS.MGET WITHLABELS FILTER <span class="nv">type</span><span class="o">=</span>temp
</span></span><span class="line"><span class="cl">1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"temp:JLM"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"type"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"temp"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"location"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"JLM"</span>
</span></span><span class="line"><span class="cl"> 3<span class="o">)</span> 1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1035</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="m">40</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"temp:TLV"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"type"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"temp"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"location"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"TLV"</span>
</span></span><span class="line"><span class="cl"> 3<span class="o">)</span> 1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1030</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="m">40</span></span></span></code></pre>
</div>
<p>
To get only the
<code>
location
</code>
label for each last sample, use
<code>
SELECTED_LABELS
</code>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">127.0.0.1:6379> TS.MGET SELECTED_LABELS location FILTER <span class="nv">type</span><span class="o">=</span>temp
</span></span><span class="line"><span class="cl">1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"temp:JLM"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"location"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"JLM"</span>
</span></span><span class="line"><span class="cl"> 3<span class="o">)</span> 1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1035</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="m">40</span>
</span></span><span class="line"><span class="cl">2<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"temp:TLV"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> 1<span class="o">)</span> 1<span class="o">)</span> <span class="s2">"location"</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="s2">"TLV"</span>
</span></span><span class="line"><span class="cl"> 3<span class="o">)</span> 1<span class="o">)</span> <span class="o">(</span>integer<span class="o">)</span> <span class="m">1030</span>
</span></span><span class="line"><span class="cl"> 2<span class="o">)</span> <span class="m">40</span></span></span></code></pre>
</div>
</details>
<h2 id="see-also">
See also
</h2>
<p>
<a href="/docs/latest/commands/ts.mrange/">
<code>
TS.MRANGE
</code>
</a>
|
<a href="/docs/latest/commands/ts.range/">
<code>
TS.RANGE
</code>
</a>
|
<a href="/docs/latest/commands/ts.mrevrange/">
<code>
TS.MREVRANGE
</code>
</a>
|
<a href="/docs/latest/commands/ts.revrange/">
<code>
TS.REVRANGE
</code>
</a>
</p>
<h2 id="related-topics">
Related topics
</h2>
<p>
<a href="/docs/latest/develop/data-types/timeseries/">
RedisTimeSeries
</a>
</p>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/ts.mget/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/redisvl/user-guide/semantic-caching/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Semantic caching
</h1>
<p class="text-lg -mt-5 mb-10">
Semantic caching with RedisVL
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
This document is a converted form of
<a href="https://github.com/RedisVentures/redisvl/blob/main/docs/user_guide/llmcache_03.ipynb">
this Jupyter notebook
</a>
.
</div>
</div>
<p>
Before beginning, be sure of the following:
</p>
<ol>
<li>
You have installed RedisVL and have that environment activated.
</li>
<li>
You have a running Redis instance with the Redis Query Engine capability.
</li>
</ol>
<h2 id="semantic-caching-for-llms">
Semantic caching for LLMs
</h2>
<p>
RedisVL provides a
<code>
SemanticCache
</code>
interface that uses Redis's built-in caching capabilities and vector search to store responses from previously-answered questions. This reduces the number of requests and tokens sent to LLM services, decreasing costs and enhancing application throughput by reducing the time taken to generate responses.
</p>
<p>
This document will teach you how to use Redis as a semantic cache for your applications.
</p>
<p>
Begin by importing
<a href="https://platform.openai.com">
OpenAI
</a>
so you can use their API for responding to user prompts. You will also create a simple
<code>
ask_openai
</code>
helper method to assist.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">os</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">getpass</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">time</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">openai</span> <span class="kn">import</span> <span class="n">OpenAI</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">numpy</span> <span class="k">as</span> <span class="nn">np</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">"TOKENIZERS_PARALLELISM"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"False"</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">api_key</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">getenv</span><span class="p">(</span><span class="s2">"OPENAI_API_KEY"</span><span class="p">)</span> <span class="ow">or</span> <span class="n">getpass</span><span class="o">.</span><span class="n">getpass</span><span class="p">(</span><span class="s2">"Enter your OpenAI API key: "</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">client</span> <span class="o">=</span> <span class="n">OpenAI</span><span class="p">(</span><span class="n">api_key</span><span class="o">=</span><span class="n">api_key</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">ask_openai</span><span class="p">(</span><span class="n">question</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">response</span> <span class="o">=</span> <span class="n">client</span><span class="o">.</span><span class="n">completions</span><span class="o">.</span><span class="n">create</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">model</span><span class="o">=</span><span class="s2">"gpt-3.5-turbo-instruct"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">max_tokens</span><span class="o">=</span><span class="mi">200</span>
</span></span><span class="line"><span class="cl"> <span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">response</span><span class="o">.</span><span class="n">choices</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">text</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Test</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">ask_openai</span><span class="p">(</span><span class="s2">"What is the capital of France?"</span><span class="p">))</span>
</span></span></code></pre>
</div>
<pre><code>The capital of France is Paris.
</code></pre>
<h2 id="initializing-semanticcache">
Initializing
<code>
SemanticCache
</code>
</h2>
<p>
Upon initialization,
<code>
SemanticCache
</code>
will automatically create an index within Redis for the semantic cache content.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="kn">from</span> <span class="nn">redisvl.extensions.llmcache</span> <span class="kn">import</span> <span class="n">SemanticCache</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span> <span class="o">=</span> <span class="n">SemanticCache</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">name</span><span class="o">=</span><span class="s2">"llmcache"</span><span class="p">,</span> <span class="c1"># underlying search index name</span>
</span></span><span class="line"><span class="cl"> <span class="n">prefix</span><span class="o">=</span><span class="s2">"llmcache"</span><span class="p">,</span> <span class="c1"># redis key prefix for hash entries</span>
</span></span><span class="line"><span class="cl"> <span class="n">redis_url</span><span class="o">=</span><span class="s2">"redis://localhost:6379"</span><span class="p">,</span> <span class="c1"># redis connection url string</span>
</span></span><span class="line"><span class="cl"> <span class="n">distance_threshold</span><span class="o">=</span><span class="mf">0.1</span> <span class="c1"># semantic cache distance threshold</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># look at the index specification created for the semantic cache lookup</span>
</span></span><span class="line"><span class="cl"><span class="err">$</span> <span class="n">rvl</span> <span class="n">index</span> <span class="n">info</span> <span class="o">-</span><span class="n">i</span> <span class="n">llmcache</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Index</span> <span class="n">Information</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="err">╭──────────────┬────────────────┬──────────────┬─────────────────┬────────────╮</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">Index</span> <span class="n">Name</span> <span class="err">│</span> <span class="n">Storage</span> <span class="n">Type</span> <span class="err">│</span> <span class="n">Prefixes</span> <span class="err">│</span> <span class="n">Index</span> <span class="n">Options</span> <span class="err">│</span> <span class="n">Indexing</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">├──────────────┼────────────────┼──────────────┼─────────────────┼────────────┤</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">llmcache</span> <span class="err">│</span> <span class="n">HASH</span> <span class="err">│</span> <span class="p">[</span><span class="s1">'llmcache'</span><span class="p">]</span> <span class="err">│</span> <span class="p">[]</span> <span class="err">│</span> <span class="mi">0</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">╰──────────────┴────────────────┴──────────────┴─────────────────┴────────────╯</span>
</span></span><span class="line"><span class="cl"> <span class="n">Index</span> <span class="n">Fields</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="err">╭───────────────┬───────────────┬────────┬────────────────┬────────────────╮</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">Name</span> <span class="err">│</span> <span class="n">Attribute</span> <span class="err">│</span> <span class="n">Type</span> <span class="err">│</span> <span class="n">Field</span> <span class="n">Option</span> <span class="err">│</span> <span class="n">Option</span> <span class="n">Value</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">├───────────────┼───────────────┼────────┼────────────────┼────────────────┤</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">prompt</span> <span class="err">│</span> <span class="n">prompt</span> <span class="err">│</span> <span class="n">TEXT</span> <span class="err">│</span> <span class="n">WEIGHT</span> <span class="err">│</span> <span class="mi">1</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">response</span> <span class="err">│</span> <span class="n">response</span> <span class="err">│</span> <span class="n">TEXT</span> <span class="err">│</span> <span class="n">WEIGHT</span> <span class="err">│</span> <span class="mi">1</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">│</span> <span class="n">prompt_vector</span> <span class="err">│</span> <span class="n">prompt_vector</span> <span class="err">│</span> <span class="n">VECTOR</span> <span class="err">│</span> <span class="err">│</span> <span class="err">│</span>
</span></span><span class="line"><span class="cl"> <span class="err">╰───────────────┴───────────────┴────────┴────────────────┴────────────────╯</span>
</span></span></code></pre>
</div>
<h2 id="basic-cache-usage">
Basic Cache Usage
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">question</span> <span class="o">=</span> <span class="s2">"What is the capital of France?"</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Check the semantic cache -- should be empty</span>
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">response</span> <span class="o">:=</span> <span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">else</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"Empty cache"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="n">Empty</span> <span class="n">cache</span>
</span></span></code></pre>
</div>
<p>
Your initial cache check should be empty since you have yet to store anything in the cache. Below, store the
<code>
question
</code>
, the
proper
<code>
response
</code>
, and any arbitrary
<code>
metadata
</code>
(as a Python dictionary object) in the cache.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Cache the question, answer, and arbitrary metadata</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">store</span><span class="p">(</span>
</span></span><span class="line"><span class="cl"> <span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">response</span><span class="o">=</span><span class="s2">"Paris"</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"> <span class="n">metadata</span><span class="o">=</span><span class="p">{</span><span class="s2">"city"</span><span class="p">:</span> <span class="s2">"Paris"</span><span class="p">,</span> <span class="s2">"country"</span><span class="p">:</span> <span class="s2">"france"</span><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="p">)</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Check the cache again</span>
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">response</span> <span class="o">:=</span> <span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">,</span> <span class="n">return_fields</span><span class="o">=</span><span class="p">[</span><span class="s2">"prompt"</span><span class="p">,</span> <span class="s2">"response"</span><span class="p">,</span> <span class="s2">"metadata"</span><span class="p">]):</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="n">response</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="k">else</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="nb">print</span><span class="p">(</span><span class="s2">"Empty cache"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="p">[{</span><span class="s1">'id'</span><span class="p">:</span> <span class="s1">'llmcache:115049a298532be2f181edb03f766770c0db84c22aff39003fec340deaec7545'</span><span class="p">,</span> <span class="s1">'vector_distance'</span><span class="p">:</span> <span class="s1">'9.53674316406e-07'</span><span class="p">,</span> <span class="s1">'prompt'</span><span class="p">:</span> <span class="s1">'What is the capital of France?'</span><span class="p">,</span> <span class="s1">'response'</span><span class="p">:</span> <span class="s1">'Paris'</span><span class="p">,</span> <span class="s1">'metadata'</span><span class="p">:</span> <span class="p">{</span><span class="s1">'city'</span><span class="p">:</span> <span class="s1">'Paris'</span><span class="p">,</span> <span class="s1">'country'</span><span class="p">:</span> <span class="s1">'france'</span><span class="p">}}]</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Check for a semantically similar result</span>
</span></span><span class="line"><span class="cl"><span class="n">question</span> <span class="o">=</span> <span class="s2">"What actually is the capital of France?"</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'response'</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s1">'Paris'</span>
</span></span></code></pre>
</div>
<h2 id="customize-the-distance-threshhold">
Customize the distance threshhold
</h2>
<p>
For most use cases, the correct semantic similarity threshhold is not a fixed quantity. Depending on the choice of embedding model,
the properties of the input query, and the business use case, the threshhold might need to change.
</p>
<p>
Fortunately, you can seamlessly adjust the threshhold at any point, as shown below:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Widen the semantic distance threshold</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">set_threshold</span><span class="p">(</span><span class="mf">0.3</span><span class="p">)</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Really try to trick it by asking around the point</span>
</span></span><span class="line"><span class="cl"><span class="c1"># But is able to slip just under our new threshold</span>
</span></span><span class="line"><span class="cl"><span class="n">question</span> <span class="o">=</span> <span class="s2">"What is the capital city of the country in Europe that also has a city named Nice?"</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">)[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'response'</span><span class="p">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="s1">'Paris'</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Invalidate the cache completely by clearing it out</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">clear</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="c1"># should be empty now</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"> <span class="p">[]</span>
</span></span></code></pre>
</div>
<h2 id="use-ttl">
Use TTL
</h2>
<p>
Redis uses optional time-to-live (TTL) policies to expire individual keys at points in time in the future.
This allows you to focus on your data flow and business logic without worrying about complex cleanup tasks.
</p>
<p>
A TTL policy set on the
<code>
SemanticCache
</code>
allows you to temporarily hold onto cache entries. Set the TTL policy to 5 seconds.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">set_ttl</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span> <span class="c1"># 5 seconds</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">store</span><span class="p">(</span><span class="s2">"This is a TTL test"</span><span class="p">,</span> <span class="s2">"This is a TTL test response"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">5</span><span class="p">)</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># confirm that the cache has cleared by now on it's own</span>
</span></span><span class="line"><span class="cl"><span class="n">result</span> <span class="o">=</span> <span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="s2">"This is a TTL test"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="p">[]</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Reset the TTL to null (long lived data)</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">set_ttl</span><span class="p">()</span>
</span></span></code></pre>
</div>
<h2 id="simple-performance-testing">
Simple performance testing
</h2>
<p>
Next, you will measure the speedup obtained by using
<code>
SemanticCache
</code>
. You will use the
<code>
time
</code>
module to measure the time taken to generate responses with and without
<code>
SemanticCache
</code>
.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="k">def</span> <span class="nf">answer_question</span><span class="p">(</span><span class="n">question</span><span class="p">:</span> <span class="nb">str</span><span class="p">)</span> <span class="o">-></span> <span class="nb">str</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="s2">"""Helper function to answer a simple question using OpenAI with a wrapper
</span></span></span><span class="line"><span class="cl"><span class="s2"> check for the answer in the semantic cache first.
</span></span></span><span class="line"><span class="cl"><span class="s2">
</span></span></span><span class="line"><span class="cl"><span class="s2"> Args:
</span></span></span><span class="line"><span class="cl"><span class="s2"> question (str): User input question.
</span></span></span><span class="line"><span class="cl"><span class="s2">
</span></span></span><span class="line"><span class="cl"><span class="s2"> Returns:
</span></span></span><span class="line"><span class="cl"><span class="s2"> str: Response.
</span></span></span><span class="line"><span class="cl"><span class="s2"> """</span>
</span></span><span class="line"><span class="cl"> <span class="n">results</span> <span class="o">=</span> <span class="n">llmcache</span><span class="o">.</span><span class="n">check</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">if</span> <span class="n">results</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">results</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s2">"response"</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"> <span class="k">else</span><span class="p">:</span>
</span></span><span class="line"><span class="cl"> <span class="n">answer</span> <span class="o">=</span> <span class="n">ask_openai</span><span class="p">(</span><span class="n">question</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="k">return</span> <span class="n">answer</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">start</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"><span class="c1"># asking a question -- openai response time</span>
</span></span><span class="line"><span class="cl"><span class="n">question</span> <span class="o">=</span> <span class="s2">"What was the name of the first US President?"</span>
</span></span><span class="line"><span class="cl"><span class="n">answer</span> <span class="o">=</span> <span class="n">answer_question</span><span class="p">(</span><span class="n">question</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="n">end</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Without caching, a call to openAI to answer this simple question took </span><span class="si">{</span><span class="n">end</span><span class="o">-</span><span class="n">start</span><span class="si">}</span><span class="s2"> seconds."</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">Without</span> <span class="n">caching</span><span class="p">,</span> <span class="n">a</span> <span class="n">call</span> <span class="n">to</span> <span class="n">openAI</span> <span class="n">to</span> <span class="n">answer</span> <span class="n">this</span> <span class="n">simple</span> <span class="n">question</span> <span class="n">took</span> <span class="mf">0.5017588138580322</span> <span class="n">seconds</span><span class="o">.</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">store</span><span class="p">(</span><span class="n">prompt</span><span class="o">=</span><span class="n">question</span><span class="p">,</span> <span class="n">response</span><span class="o">=</span><span class="s2">"George Washington"</span><span class="p">)</span>
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Calculate the avg latency for caching over LLM usage</span>
</span></span><span class="line"><span class="cl"><span class="n">times</span> <span class="o">=</span> <span class="p">[]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">10</span><span class="p">):</span>
</span></span><span class="line"><span class="cl"> <span class="n">cached_start</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="n">cached_answer</span> <span class="o">=</span> <span class="n">answer_question</span><span class="p">(</span><span class="n">question</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"> <span class="n">cached_end</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"> <span class="n">times</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cached_end</span><span class="o">-</span><span class="n">cached_start</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">avg_time_with_cache</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">mean</span><span class="p">(</span><span class="n">times</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Avg time taken with LLM cache enabled: </span><span class="si">{</span><span class="n">avg_time_with_cache</span><span class="si">}</span><span class="s2">"</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">"Percentage of time saved: </span><span class="si">{</span><span class="nb">round</span><span class="p">(((</span><span class="n">end</span> <span class="o">-</span> <span class="n">start</span><span class="p">)</span> <span class="o">-</span> <span class="n">avg_time_with_cache</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="n">end</span> <span class="o">-</span> <span class="n">start</span><span class="p">)</span> <span class="o">*</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span><span class="si">}</span><span class="s2">%"</span><span class="p">)</span>
</span></span></code></pre>
</div>
<p>
Avg time taken with LLM cache enabled: 0.2560166358947754
Percentage of time saved: 82.47%
</p>
<pre tabindex="0"><code>
```bash
# check the stats of the index
$ rvl stats -i llmcache
Statistics:
╭─────────────────────────────┬─────────────╮
│ Stat Key │ Value │
├─────────────────────────────┼─────────────┤
│ num_docs │ 1 │
│ num_terms │ 19 │
│ max_doc_id │ 3 │
│ num_records │ 23 │
│ percent_indexed │ 1 │
│ hash_indexing_failures │ 0 │
│ number_of_uses │ 19 │
│ bytes_per_record_avg │ 5.30435 │
│ doc_table_size_mb │ 0.000134468 │
│ inverted_sz_mb │ 0.000116348 │
│ key_table_size_mb │ 2.76566e-05 │
│ offset_bits_per_record_avg │ 8 │
│ offset_vectors_sz_mb │ 2.09808e-05 │
│ offsets_per_term_avg │ 0.956522 │
│ records_per_doc_avg │ 23 │
│ sortable_values_size_mb │ 0 │
│ total_indexing_time │ 1.211 │
│ total_inverted_index_blocks │ 19 │
│ vector_index_sz_mb │ 3.0161 │
╰─────────────────────────────┴─────────────╯
</code></pre>
<div class="highlight">
<pre class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="c1"># Clear the cache AND delete the underlying index</span>
</span></span><span class="line"><span class="cl"><span class="n">llmcache</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/redisvl/user-guide/semantic-caching/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Install Redis Enterprise Software on Linux
</h1>
<p class="text-lg -mt-5 mb-10">
Install Redis Enterprise Software on Linux.
</p>
<p>
After you
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/prepare-install/download-install-package/">
download a Redis Enterprise Software installation package
</a>
, install it on one of the nodes in the cluster.
</p>
<p>
For installation on machines without an internet connection, see
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/offline-installation/">
Offline installation
</a>
.
</p>
<h2 id="install-on-linux">
Install on Linux
</h2>
<p>
To install Redis Enterprise Software, use the command line:
</p>
<ol>
<li>
<p>
Copy the installation package to the node.
</p>
</li>
<li>
<p>
On the node, change to the directory where the installation package is located and extract the installation files:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">tar vxf <tarfile name>
</span></span></code></pre>
</div>
</li>
<li>
<p>
<em>
(Optional)
</em>
Use the
<a download="" href="../GPG-KEY-redislabs-packages.gpg">
GPG key file
</a>
to confirm the authenticity of Ubuntu/Debian or RHEL RPM packages:
</p>
<ul>
<li>
<p>
For Ubuntu:
</p>
<ol>
<li>
Import the key:
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">gpg --import <path to GPG key>
</span></span></code></pre>
</div>
<ol start="2">
<li>
Verify the package signature:
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">dpkg-sig --verify </path-to/package.deb>
</span></span></code></pre>
</div>
</li>
<li>
<p>
For RHEL:
</p>
<ol>
<li>
Import the key:
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rpm --import <path to GPG key>
</span></span></code></pre>
</div>
<ol start="2">
<li>
Verify the package signature:
</li>
</ol>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rpm --checksig </path-to/package.rpm>
</span></span></code></pre>
</div>
</li>
</ul>
</li>
<li>
<p>
To start the installation process, run the installation script. See
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/install-script/">
installation script options
</a>
for a list of command-line options you can add to the following command:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo ./install.sh
</span></span></code></pre>
</div>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<ul>
<li>
The Redis Enterprise Software files are installed in the default
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/file-locations/">
file locations
</a>
.
</li>
<li>
By default, Redis Enterprise Software runs on the OS as the
<code>
redislabs
</code>
user and
<code>
redislabs
</code>
group. If needed, you can
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/customize-user-and-group/">
specify a different user and group
</a>
during the installation.
</li>
<li>
You must either be the root user or use
<code>
sudo
</code>
to run the installation script.
</li>
</ul>
</div>
</div>
</li>
<li>
<p>
Answer the
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/manage-installation-questions/">
installation questions
</a>
when shown to complete the installation process.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<p>
To skip the installation questions, use one of the following methods:
</p>
<ul>
<li>
Run
<code>
./install.sh -y
</code>
to answer yes to all of the questions.
</li>
<li>
Create an
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/manage-installation-questions/#configure-file-to-answer">
answer file
</a>
to answer installation questions automatically.
</li>
</ul>
</div>
</div>
</li>
<li>
<p>
When installation completes successfully, the output displays the Cluster Manager UI's IP address:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">Summary:
</span></span><span class="line"><span class="cl">-------
</span></span><span class="line"><span class="cl">ALL TESTS PASSED.
</span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> Please <span class="nb">logout</span> and login again to make
</span></span><span class="line"><span class="cl">sure all environment changes are applied.
</span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> Point your browser at the following
</span></span><span class="line"><span class="cl">URL to <span class="k">continue</span>:
</span></span><span class="line"><span class="cl">2017-04-24 10:54:15 <span class="o">[</span>!<span class="o">]</span> https://<your_ip_here>:8443
</span></span></code></pre>
</div>
</li>
<li>
<p>
Repeat this process for each node in the cluster.
</p>
</li>
</ol>
<h2 id="auto-tiering-installation">
Auto Tiering installation
</h2>
<p>
If you want to use Auto Tiering for your databases, review the prerequisites, storage requirements, and
<a href="/docs/latest/operate/rs/7.4/databases/auto-tiering/">
other considerations
</a>
for Auto Tiering databases and prepare and format the flash memory.
</p>
<p>
After you
<a href="#install-on-linux">
install on Linux
</a>
, use the
<code>
prepare_flash
</code>
script to prepare and format flash memory:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo /opt/redislabs/sbin/prepare_flash.sh
</span></span></code></pre>
</div>
<p>
This script finds unformatted disks and mounts them as RAID partitions in
<code>
/var/opt/redislabs/flash
</code>
.
</p>
<p>
To verify the disk configuration, run:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">sudo lsblk
</span></span></code></pre>
</div>
<h2 id="more-info-and-options">
More info and options
</h2>
<p>
To learn more about customization and find answers to related questions, see:
</p>
<ul>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/configuring/centos-rhel-firewall/">
CentOS/RHEL firewall configuration
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/configuring/change-location-socket-files/">
Change socket file location
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/networking/cluster-dns/">
Cluster DNS configuration
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/networking/cluster-lba-setup/">
Cluster load balancer setup
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/networking/mdns/">
mDNS client prerequisites
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/file-locations/">
File locations
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/plan-deployment/supported-platforms/">
Supported platforms
</a>
</li>
</ul>
<h2 id="limitations">
Limitations
</h2>
<p>
Several Redis Enterprise Software installation reference files are installed to the directory
<code>
/etc/opt/redislabs/
</code>
even if you use
<a href="/docs/latest/operate/rs/7.4/installing-upgrading/install/customize-install-directories/">
custom installation directories
</a>
.
</p>
<p>
As a workaround to install Redis Enterprise Software without using any root directories, do the following before installing Redis Enterprise Software:
</p>
<ol>
<li>
<p>
Create all custom, non-root directories you want to use with Redis Enterprise Software.
</p>
</li>
<li>
<p>
Mount
<code>
/etc/opt/redislabs
</code>
to one of the custom, non-root directories.
</p>
</li>
</ol>
<h2 id="next-steps">
Next steps
</h2>
<ol>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/clusters/new-cluster-setup/">
Create
</a>
or
<a href="/docs/latest/operate/rs/7.4/clusters/add-node/">
join
</a>
an existing Redis Enterprise Software cluster.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/databases/create/">
Create a database
</a>
.
</p>
<p>
For geo-distributed Active-Active replication, create an
<a href="/docs/latest/operate/rs/7.4/databases/active-active/create/">
Active-Active
</a>
database.
</p>
</li>
<li>
<p>
<a href="/docs/latest/operate/rs/7.4/security/access-control/create-users/">
Add users
</a>
to the cluster with specific permissions. To begin, start with
<a href="/docs/latest/operate/rs/7.4/security/access-control/">
Access control
</a>
.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/installing-upgrading/install/install-on-linux/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/.html | <section class="prose w-full py-12 max-w-none">
<h1>
BDB alert settings with threshold object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the bdb_alert_settings_with_threshold object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
enabled
</td>
<td>
boolean (default: false)
</td>
<td>
Alert enabled or disabled
</td>
</tr>
<tr>
<td>
threshold
</td>
<td>
string
</td>
<td>
Threshold for alert going on/off
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/pfcount/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PFCOUNT
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PFCOUNT key [key ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.8.9
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1) with a very small average constant time when called with a single key. O(N) with N being the number of keys, and much bigger constant times, when called with multiple keys.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@hyperloglog
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
When called with a single key, returns the approximated cardinality computed by the HyperLogLog data structure stored at the specified variable, which is 0 if the variable does not exist.
</p>
<p>
When called with multiple keys, returns the approximated cardinality of the union of the HyperLogLogs passed, by internally merging the HyperLogLogs stored at the provided keys into a temporary HyperLogLog.
</p>
<p>
The HyperLogLog data structure can be used in order to count
<strong>
unique
</strong>
elements in a set using just a small constant amount of memory, specifically 12k bytes for every HyperLogLog (plus a few bytes for the key itself).
</p>
<p>
The returned cardinality of the observed set is not exact, but approximated with a standard error of 0.81%.
</p>
<p>
For example in order to take the count of all the unique search queries performed in a day, a program needs to call
<a href="/docs/latest/commands/pfadd/">
<code>
PFADD
</code>
</a>
every time a query is processed. The estimated number of unique queries can be retrieved with
<code>
PFCOUNT
</code>
at any time.
</p>
<p>
Note: as a side effect of calling this function, it is possible that the HyperLogLog is modified, since the last 8 bytes encode the latest computed cardinality
for caching purposes. So
<code>
PFCOUNT
</code>
is technically a write command.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> PFADD hll foo bar zap
(integer) 1
redis> PFADD hll zap zap zap
(integer) 0
redis> PFADD hll foo bar
(integer) 0
redis> PFCOUNT hll
(integer) 3
redis> PFADD some-other-hll 1 2 3
(integer) 1
redis> PFCOUNT hll some-other-hll
(integer) 6
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="performances">
Performances
</h2>
<p>
When
<code>
PFCOUNT
</code>
is called with a single key, performances are excellent even if
in theory constant times to process a dense HyperLogLog are high. This is
possible because the
<code>
PFCOUNT
</code>
uses caching in order to remember the cardinality
previously computed, that rarely changes because most
<a href="/docs/latest/commands/pfadd/">
<code>
PFADD
</code>
</a>
operations will
not update any register. Hundreds of operations per second are possible.
</p>
<p>
When
<code>
PFCOUNT
</code>
is called with multiple keys, an on-the-fly merge of the
HyperLogLogs is performed, which is slow, moreover the cardinality of the union
can't be cached, so when used with multiple keys
<code>
PFCOUNT
</code>
may take a time in
the order of magnitude of the millisecond, and should be not abused.
</p>
<p>
The user should take in mind that single-key and multiple-keys executions of
this command are semantically different and have different performances.
</p>
<h2 id="hyperloglog-representation">
HyperLogLog representation
</h2>
<p>
Redis HyperLogLogs are represented using a double representation: the
<em>
sparse
</em>
representation suitable for HLLs counting a small number of elements (resulting in a small number of registers set to non-zero value), and a
<em>
dense
</em>
representation suitable for higher cardinalities. Redis automatically switches from the sparse to the dense representation when needed.
</p>
<p>
The sparse representation uses a run-length encoding optimized to store efficiently a big number of registers set to zero. The dense representation is a Redis string of 12288 bytes in order to store 16384 6-bit counters. The need for the double representation comes from the fact that using 12k (which is the dense representation memory requirement) to encode just a few registers for smaller cardinalities is extremely suboptimal.
</p>
<p>
Both representations are prefixed with a 16 bytes header, that includes a magic, an encoding / version field, and the cached cardinality estimation computed, stored in little endian format (the most significant bit is 1 if the estimation is invalid since the HyperLogLog was updated since the cardinality was computed).
</p>
<p>
The HyperLogLog, being a Redis string, can be retrieved with
<a href="/docs/latest/commands/get/">
<code>
GET
</code>
</a>
and restored with
<a href="/docs/latest/commands/set/">
<code>
SET
</code>
</a>
. Calling
<a href="/docs/latest/commands/pfadd/">
<code>
PFADD
</code>
</a>
,
<code>
PFCOUNT
</code>
or
<a href="/docs/latest/commands/pfmerge/">
<code>
PFMERGE
</code>
</a>
commands with a corrupted HyperLogLog is never a problem, it may return random values but does not affect the stability of the server. Most of the times when corrupting a sparse representation, the server recognizes the corruption and returns an error.
</p>
<p>
The representation is neutral from the point of view of the processor word size and endianness, so the same representation is used by 32 bit and 64 bit processor, big endian or little endian.
</p>
<p>
More details about the Redis HyperLogLog implementation can be found in
<a href="http://antirez.com/news/75">
this blog post
</a>
. The source code of the implementation in the
<code>
hyperloglog.c
</code>
file is also easy to read and understand, and includes a full specification for the exact encoding used for the sparse and dense representations.
</p>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the approximated number of unique elements observed via
<code>
PFADD
</code>
.
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the approximated number of unique elements observed via
<code>
PFADD
</code>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/pfcount/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/security/access-control/saml-sso/saml-integration-okta-generic/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Okta SAML integration guide (Generic)
</h1>
<p class="text-lg -mt-5 mb-10">
This integration guide shows how to set up Okta as a SAML single sign-on provider for your Redis Cloud account.
</p>
<p>
This guide shows how to configure
<a href="https://help.okta.com/en-us/Content/Topics/Security/Identity_Providers.htm">
Okta
</a>
as a SAML single sign-on identity provider (IdP) for your Redis Cloud account.
</p>
<p>
Learn how to use the generic application template. You can also refer to the
<a href="/docs/latest/operate/rc/security/access-control/saml-sso/saml-integration-okta-org2org/">
Org2Org
</a>
application template.
</p>
<p>
To learn more about Redis Cloud support for SAML, see
<a href="/docs/latest/operate/rc/security/access-control/saml-sso/">
SAML single sign-on
</a>
.
</p>
<p>
Before completing this guide, you must
<a href="/docs/latest/operate/rc/security/access-control/saml-sso/#verify-domain">
verify ownership of any domains
</a>
you want to associate with your SAML setup.
</p>
<h2 id="step-1-set-up-your-demo-identity-provider-idp">
Step 1: Set up your demo identity provider (IdP)
</h2>
<p>
To create the Okta SAML integration application:
</p>
<ol>
<li>
<p>
Log in to the Okta admin console. Select
<strong>
Applications > Create App Integration
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_1.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_1.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_1.png"/>
</a>
</li>
<li>
<p>
Select
<strong>
SAML 2.0
</strong>
, then select
<strong>
Next
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_2.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_2.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_2.png"/>
</a>
</li>
<li>
<p>
Complete these fields for the SAML application
<strong>
General Settings
</strong>
section:
</p>
<ul>
<li>
<p>
<strong>
App name
</strong>
: Redis Cloud
</p>
</li>
<li>
<p>
<strong>
App logo
</strong>
: Upload a Redis icon.
</p>
</li>
</ul>
<p>
Select
<strong>
Next
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_3.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_3.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_3.png"/>
</a>
</li>
<li>
<p>
In the
<strong>
Configure SAML
</strong>
tab, enter this data in the
<strong>
General
</strong>
section:
</p>
<ul>
<li>
<strong>
Single sign-on URL
</strong>
:
<code>
http://www.fake.com
</code>
. This is a temporary mock URL that you will modify later.
</li>
<li>
<strong>
Audience URI (SP Entity ID)
</strong>
:
<code>
http://www.fake.com
</code>
. This is a temporary mock URL that you will modify later.
</li>
<li>
<strong>
Default RelayState
</strong>
:
<code>
https://cloud.redis.io/#/login/?idpId=XXXXXX
</code>
. You will need to complete this URL with the
<code>
idpId
</code>
later.
<em>
Complete this field only if you need your SAML flow to be IdP initiated.
</em>
</li>
<li>
<strong>
Name ID forma
</strong>
:
<code>
Unspecified
</code>
</li>
<li>
<strong>
Application username
</strong>
:
<code>
Okta username
</code>
</li>
<li>
<strong>
Update application username on
</strong>
:
<code>
Create and update
</code>
</li>
</ul>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_4.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_4.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_4.png"/>
</a>
<p>
Next, add
<strong>
attribute statements
</strong>
, which are required for the configuration:
</p>
<ul>
<li>
<p>
<strong>
Attribute 1
</strong>
:
</p>
<ul>
<li>
<strong>
Name
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Name Format
</strong>
:
<code>
Basic
</code>
</li>
<li>
<strong>
Value
</strong>
:
<code>
appuser.redisAccountMapping
</code>
</li>
</ul>
</li>
<li>
<p>
<strong>
Attribute 2
</strong>
:
</p>
<ul>
<li>
<strong>
Name
</strong>
:
<code>
FirstName
</code>
</li>
<li>
<strong>
Name Format
</strong>
:
<code>
Basic
</code>
</li>
<li>
<strong>
Value
</strong>
:
<code>
user.firstName
</code>
</li>
</ul>
</li>
<li>
<p>
<strong>
Attribute 3
</strong>
:
</p>
<ul>
<li>
<strong>
Name
</strong>
:
<code>
LastName
</code>
</li>
<li>
<strong>
Name Format
</strong>
:
<code>
Basic
</code>
</li>
<li>
<strong>
Value
</strong>
:
<code>
user.lastName
</code>
</li>
</ul>
</li>
<li>
<p>
<strong>
Attribute 4
</strong>
:
</p>
<ul>
<li>
<strong>
Name
</strong>
:
<code>
Email
</code>
</li>
<li>
<strong>
Name Format
</strong>
:
<code>
Basic
</code>
</li>
<li>
<strong>
Value
</strong>
:
<code>
user.login
</code>
</li>
</ul>
</li>
</ul>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_5.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_5.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_5.png"/>
</a>
<p>
Select
<strong>
Next
</strong>
.
</p>
</li>
<li>
<p>
The last step is an optional feedback step for Okta. Select
<strong>
I'm an Okta customer adding an internal app
</strong>
and then select
<strong>
Finish
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_6.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_6.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_6.png"/>
</a>
</li>
<li>
<p>
Next, scroll down the page of your newly created app integration and select
<strong>
View Setup Instructions
</strong>
. A new browser window opens, providing the information you need to configure the IdP in Redis Cloud.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_7.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_7.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_7.png"/>
</a>
<p>
Scroll down to
<strong>
Applications > Applications
</strong>
, and note down the following information:
</p>
<ul>
<li>
<strong>
Identity Provider Single Sign-On URL
</strong>
</li>
<li>
<strong>
Identity Provider Issuer
</strong>
</li>
<li>
<strong>
X.509 Certificate
</strong>
</li>
</ul>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_8.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_8.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_8.png"/>
</a>
<p>
Once you save the information, close the window.
</p>
</li>
</ol>
<p>
To modify the application user profile:
</p>
<ol>
<li>
<p>
Go to
<strong>
Directory > Profile Editor
</strong>
in the left menu, and select
<strong>
Redis Cloud User
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_9.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_9.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_9.png"/>
</a>
</li>
<li>
<p>
Add the custom attribute to your user profile to specify which Redis Cloud role the user has and on which account. Select
<strong>
Add Attribute
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_10.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_10.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_10.png"/>
</a>
</li>
<li>
<p>
Add this information for the new custom attribute.
</p>
<ul>
<li>
<strong>
Data type
</strong>
:
<code>
string array
</code>
</li>
<li>
<strong>
Display name
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Variable name
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Description
</strong>
:
<code>
redisAccountMapping
</code>
</li>
<li>
<strong>
Attribute required
</strong>
:
<code>
Yes
</code>
</li>
<li>
<strong>
Group priority
</strong>
:
<code>
Combine values across groups
</code>
</li>
</ul>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_11.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_11.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_11.png"/>
</a>
</li>
<li>
<p>
Once you add the attribute, it appears in the list of attributes for the profile.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_9.png" sdata-lightbox="/images/rc/saml/okta_saml_9.png">
<img src="/docs/latest/images/rc/saml/okta_saml_9.png"/>
</a>
</li>
</ol>
<h2 id="step-2-create-a-group-and-assign-the-application">
Step 2: Create a group and assign the application
</h2>
<p>
Now that your SAML IdP is configured, create an Okta group and assign users to the Redis Cloud application.
</p>
<h3 id="create-the-group">
Create the group
</h3>
<ol>
<li>
<p>
In the left menu, select
<strong>
Directory > Groups
</strong>
, then select
<strong>
Add group
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_1.png" sdata-lightbox="/images/rc/saml/okta_saml_group_1.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_1.png"/>
</a>
</li>
<li>
<p>
Complete
<strong>
Name
</strong>
and
<strong>
Description
</strong>
, then click
<strong>
Save
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_2.png" sdata-lightbox="/images/rc/saml/okta_saml_group_2.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_2.png"/>
</a>
<a href="/docs/latest/images/rc/saml/okta_saml_group_3.png" sdata-lightbox="/images/rc/saml/okta_saml_group_3.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_3.png"/>
</a>
</li>
</ol>
<h3 id="assign-users-to-the-group">
Assign users to the group
</h3>
<ol>
<li>
<p>
Select the group, then select
<strong>
Assign people
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_4.png" sdata-lightbox="/images/rc/saml/okta_saml_group_4.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_4.png"/>
</a>
</li>
<li>
<p>
For each user you want to add to the group, highlight the user in the table and select
<strong>
+
</strong>
. You can also select
<strong>
Add all
</strong>
to add all users. Once you add all the users to your group, select
<strong>
Save
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_5.png" sdata-lightbox="/images/rc/saml/okta_saml_group_5.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_5.png"/>
</a>
</li>
</ol>
<h3 id="assign-the-application-to-the-group">
Assign the application to the group
</h3>
<p>
Now that your group is populated with its users, you can assign the SAML integration application to your group. From
<strong>
Applications > Applications > Redis Cloud
</strong>
:
</p>
<ol>
<li>
<p>
Select
<strong>
Assign to groups
</strong>
menu item.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_6.png" sdata-lightbox="/images/rc/saml/okta_saml_group_6.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_6.png"/>
</a>
</li>
<li>
<p>
In the
<strong>
Redis Cloud User Group
</strong>
, select
<strong>
Assign
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_7.png" sdata-lightbox="/images/rc/saml/okta_saml_group_7.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_7.png"/>
</a>
</li>
<li>
<p>
Define the Redis account mapping string default for this group and select
<strong>
Save and Go Back
</strong>
. The key-value pair consists of the lowercase role name (owner, member, manager, billing_admin, or viewer) and your
<strong>
Redis Cloud Account ID
</strong>
found in the
<a href="/docs/latest/operate/rc/accounts/account-settings/">
account settings
</a>
. Select
<strong>
"Done"
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_8.png" sdata-lightbox="/images/rc/saml/okta_saml_group_8.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_8.png"/>
</a>
<p>
The mapping field has now been defined as a default for each member of the group.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_9.png" sdata-lightbox="/images/rc/saml/okta_saml_group_9.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_9.png"/>
</a>
</li>
</ol>
<h3 id="edit-the-mapping-field-for-the-group">
Edit the mapping field for the group
</h3>
<p>
To modify the Redis mapping field, select the pencil icon of the Redis Cloud group in the
<strong>
Redis Cloud
</strong>
application screen.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_10.png" sdata-lightbox="/images/rc/saml/okta_saml_group_10.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_10.png"/>
</a>
<p>
You can modify the mapping field for the whole group on the edit screen that appears.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_11.png" sdata-lightbox="/images/rc/saml/okta_saml_group_11.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_11.png"/>
</a>
<h3 id="edit-the-mapping-field-for-a-specific-user">
Edit the mapping field for a specific user
</h3>
<p>
To override the Redis mapping field at an individual user level, select the
<strong>
People
</strong>
menu, and then the pencil icon of the person whose field you want to modify.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_15.png" sdata-lightbox="/images/rc/saml/okta_saml_group_15.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_15.png"/>
</a>
<p>
Set the user's
<strong>
Assignment master
</strong>
to
<strong>
Administrator
</strong>
, enabling the group's policy override. Select
<strong>
Save
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_13.png" sdata-lightbox="/images/rc/saml/okta_saml_group_13.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_13.png"/>
</a>
<p>
The user's
<strong>
Type
</strong>
is set to
<code>
Individual
</code>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_14.png" sdata-lightbox="/images/rc/saml/okta_saml_group_14.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_14.png"/>
</a>
<p>
On the screen that appears, select the pencil icon of the user to modify the Redis mapping field.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_15.png" sdata-lightbox="/images/rc/saml/okta_saml_group_15.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_15.png"/>
</a>
<p>
Then, edit the user assignment.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_group_16.png" sdata-lightbox="/images/rc/saml/okta_saml_group_16.png">
<img src="/docs/latest/images/rc/saml/okta_saml_group_16.png"/>
</a>
<h2 id="step-3-configure-saml-support-in-redis-cloud">
Step 3: Configure SAML support in Redis Cloud
</h2>
<p>
Now that you have a test IdP server ready as well as your user group, configure support for SAML in Redis Cloud.
</p>
<h3 id="sign-in-to-redis-cloud">
Sign in to Redis Cloud
</h3>
<p>
Sign in to your account on the
<a href="https://cloud.redis.io/#/login">
Redis Cloud console
</a>
.
</p>
<h3 id="activate-saml-in-access-management">
Activate SAML in Access Management
</h3>
<p>
To activate SAML, you must have a local user (or social sign-on user) with the
<strong>
owner
</strong>
role. If you have the correct permissions, you will see the
<strong>
Single Sign-On
</strong>
tab.
</p>
<ol>
<li>
<p>
Fill in the information you saved in step 6 in the
<strong>
setup
</strong>
form, including:
</p>
<ul>
<li>
<strong>
IdP Server URL
</strong>
: Identity Provider Single Sign-On URL
</li>
<li>
<strong>
Issuer
</strong>
: Identity Provider Issuer
</li>
<li>
<strong>
Assertion signing certificate
</strong>
: X.509 Certificate
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_1.png" sdata-lightbox="/images/rc/saml/sm_saml_1.png">
<img src="/docs/latest/images/rc/saml/sm_saml_1.png"/>
</a>
</li>
<li>
<p>
Select
<strong>
Enable
</strong>
and wait a few seconds for the status to change. You are then able to download the service provider (SP) metadata. Save the file to your local hard disk.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_3.png" sdata-lightbox="/images/rc/saml/sm_saml_3.png">
<img src="/docs/latest/images/rc/saml/sm_saml_3.png"/>
</a>
</li>
<li>
<p>
Open the file in any text editor. Save the following text from the metadata:
</p>
<ul>
<li>
<strong>
EntityID
</strong>
: The unique name of the service provider (SP)
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_4.png" sdata-lightbox="/images/rc/saml/sm_saml_4.png">
<img src="/docs/latest/images/rc/saml/sm_saml_4.png"/>
</a>
<ul>
<li>
<strong>
Location
</strong>
: The location of the assertion consumer service
</li>
</ul>
<a href="/docs/latest/images/rc/saml/sm_saml_5.png" sdata-lightbox="/images/rc/saml/sm_saml_5.png">
<img src="/docs/latest/images/rc/saml/sm_saml_5.png"/>
</a>
</li>
<li>
<p>
Return to Okta, select
<strong>
Applications > Redis Cloud > General
</strong>
and select
<strong>
Edit
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_12.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_12.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_12.png"/>
</a>
</li>
<li>
<p>
Then, navigate to
<strong>
Configure SAML
</strong>
(step 2) and update the following information in
<strong>
SAML Settings General
</strong>
:
</p>
<ul>
<li>
<strong>
Single sign-on URL
</strong>
: Use the information that you copied for
<strong>
Location
</strong>
.
</li>
<li>
<strong>
Audience URI (SP Entity ID)
</strong>
: Use the information that you copied for
<strong>
EntityID
</strong>
.
</li>
<li>
<strong>
Default RelayState
</strong>
: Only needed if you want to have an IdP initiated flow. Take the ID from the location URL in step 3 (the content after the last forward slash "/") and append to the url (for example,
<code>
https://cloud.redis.io/#/login/?idpId=YOUR_LOCATION_ID
</code>
).
</li>
</ul>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_13.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_13.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_13.png"/>
</a>
<p>
Select
<strong>
Next
</strong>
, then select
<strong>
Finish
</strong>
.
</p>
</li>
</ol>
<h3 id="return-to-redis-cloud-console">
Return to Redis Cloud console
</h3>
<ol>
<li>
<p>
Return to Redis Cloud console and select
<strong>
Activate
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_8.png" sdata-lightbox="/images/rc/saml/sm_saml_8.png">
<img src="/docs/latest/images/rc/saml/sm_saml_8.png"/>
</a>
<p>
A popup appears, stating that to test the SAML connection, you need to log in with Okta credentials of the user defined in the Redis Cloud group. This user is part of the group to which you assigned the Redis Cloud application.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_9.png" sdata-lightbox="/images/rc/saml/sm_saml_9.png">
<img src="/docs/latest/images/rc/saml/sm_saml_9.png"/>
</a>
</li>
<li>
<p>
The Okta login screen appears. Enter the credentials and select
<strong>
Sign In
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_14.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_14.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_14.png"/>
</a>
</li>
<li>
<p>
If the test succeeds, your local account is now considered a SAML account. To log in to Redis Cloud console going forward, select
<strong>
Sign in with SSO
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/sm_saml_11.png" sdata-lightbox="/images/rc/saml/sm_saml_11.png">
<img src="/docs/latest/images/rc/saml/sm_saml_11.png"/>
</a>
</li>
<li>
<p>
Enter your SAML email and click
<strong>
Login
</strong>
.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_15.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_15.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_15.png"/>
</a>
</li>
<li>
<p>
If only one user is defined in Redis Cloud console, you get a popup window where you select
<strong>
Confirm
</strong>
to convert the local user to a SAML user. Consider setting up one more local user other than a SAML user.
</p>
<a href="/docs/latest/images/rc/saml/okta_saml_app_int_16.png" sdata-lightbox="/images/rc/saml/okta_saml_app_int_16.png">
<img src="/docs/latest/images/rc/saml/okta_saml_app_int_16.png"/>
</a>
</li>
<li>
<p>
You have successfully configured SAML as an identity provider.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/security/access-control/saml-sso/saml-integration-okta-generic/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisstack/redisstack-7.4-release-notes/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Stack 7.4 release notes
</h1>
<p class="text-lg -mt-5 mb-10">
Redis Stack 7.4 release notes.
</p>
<h2 id="redis-stack-740-v1-october-2024">
Redis Stack 7.4.0-v1 (October 2024)
</h2>
<p>
This is a maintenance release for Redis Stack Server 7.4.0.
</p>
<p>
Update urgency:
<code>
SECURITY
</code>
: there are security fixes in the release.
</p>
<p>
<a href="https://hub.docker.com/r/redis/redis-stack">
Docker
</a>
|
<a href="https://redis.io/downloads/#stack">
Download
</a>
</p>
<h3 id="headlines">
Headlines
</h3>
<p>
This version includes security fixes for the
<strong>
Redis
</strong>
server, addressing potential vulnerabilities such as an RCE when using Lua library components, and a denial-of-service (DoS) risk due to malformed ACL selectors or unbounded pattern matching.
Additionally, this maintenance release includes the latest version of
<strong>
Redis Insight
</strong>
.
</p>
<h3 id="details">
Details
</h3>
<p>
<strong>
Security and privacy
</strong>
</p>
<ul>
<li>
<strong>
Redis
</strong>
:
<ul>
<li>
(CVE-2024-31449) Lua library commands may lead to stack overflow and potential RCE.
</li>
<li>
(CVE-2024-31227) Potential Denial-of-service due to malformed ACL selectors.
</li>
<li>
(CVE-2024-31228) Potential Denial-of-service due to unbounded pattern matching.
</li>
</ul>
</li>
</ul>
<p>
<strong>
Redis Community Edition version
</strong>
</p>
<ul>
<li>
<a href="https://github.com/redis/redis/releases/tag/7.4.1">
Redis 7.4.1
</a>
</li>
</ul>
<p>
<strong>
Module versions
</strong>
</p>
<ul>
<li>
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.10.5">
RediSearch 2.10.5
</a>
</li>
<li>
<a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.8.3">
RedisJSON 2.8.3
</a>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.12.2">
RedisTimeSeries 1.12.2
</a>
</li>
<li>
<a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.8.2">
RedisBloom 2.8.2
</a>
</li>
</ul>
<p>
<strong>
Recommended client libraries
</strong>
</p>
<ul>
<li>
Java
<ul>
<li>
<a href="https://github.com/redis/jedis/releases/tag/v5.2.0">
Jedis 5.2.0 or later
</a>
</li>
<li>
<a href="https://github.com/redis/lettuce/releases/tag/6.4.0.RELEASE">
Lettuce 6.4.0 or later
</a>
</li>
</ul>
</li>
<li>
Python
<ul>
<li>
<a href="https://github.com/redis/redis-py/releases/tag/v5.1.0">
redis-py 5.1.0 or later
</a>
</li>
</ul>
</li>
<li>
NodeJS
<ul>
<li>
<a href="https://github.com/redis/node-redis/releases/tag/redis%404.7.0">
node-redis 4.7.0 or later
</a>
</li>
</ul>
</li>
<li>
Go
<ul>
<li>
<a href="https://github.com/redis/go-redis/releases/tag/v9.6.1">
go-redis 9.6.1 or later
</a>
</li>
</ul>
</li>
</ul>
<p>
Compatible with
<a href="https://redis.io/download">
Redis Insight
</a>
. The docker image redis/redis-stack for this version is bundled with
<a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.58.0">
Redis Insight 2.58
</a>
.
</p>
<p>
Note: version numbers follow the pattern:
</p>
<p>
<code>
x.y.z-b
</code>
</p>
<ul>
<li>
<code>
x.y
</code>
Redis Major version
</li>
<li>
<code>
z
</code>
increases with even numbers as a module x.y version increases.
</li>
<li>
<code>
b
</code>
denotes a patch to Redis or a module (any
<code>
z
</code>
of Redis or modules).
<code>
b
</code>
will consist of a
<code>
v
</code>
+ numeric value.
</li>
</ul>
<h2 id="redis-community-edition-740-v0-july-2024">
Redis Community Edition 7.4.0-v0 (July 2024)
</h2>
<p>
This is a GA release of Redis Stack version 7.4.
</p>
<p>
<a href="https://hub.docker.com/r/redis/redis-stack">
Docker
</a>
|
<a href="https://redis.io/downloads/#stack">
Download
</a>
</p>
<h3 id="headlines-1">
Headlines
</h3>
<p>
<strong>
Data Structures
</strong>
</p>
<p>
<code>
Hash
</code>
: Redis now supports expiration of individual hash fields. Redis already supports key expiration. For each key, users can specify a time when it should expire, or specify the remaining time-to-live (TTL) after which it would expire. One very frequent request was to allow specifying expiration time or TTL also for individual hash fields, which is now supported using nine new Redis commands:
</p>
<ul>
<li>
<code>
HEXPIRE
</code>
,
<code>
HPEXPIRE
</code>
,
<code>
HEXPIREAT
</code>
,
<code>
HPEXPIREAT
</code>
- set the time when specific hash fields should expire, or the remaining time-to-live for specific fields.
</li>
<li>
<code>
HTTL
</code>
,
<code>
HPTTL
</code>
,
<code>
HEXPIRETIME
</code>
,
<code>
HPEXPIRETIME
</code>
- retrieve the time when specific hash fields should expire, or the remaining time-to-live for specific fields
</li>
<li>
<code>
HPERSIST
</code>
- remove the expiration of specific hash fields.
</li>
</ul>
<p>
<code>
Streams
</code>
: It is now possible to start reading from the last stream message using
<code>
XREAD
</code>
with the new id value
<code>
+
</code>
.
There are many additional improvements, including new command arguments, security, performance, and resource utilization enhancements, several new metrics and configuration parameters were introduced, and multiple bugs were fixed.
</p>
<p>
<code>
Time series
</code>
: The latest time series data structure adds a highly requested feature: insertion-filter for close samples. Many sensors report data periodically. Often, the difference between the measured value and the previously measured value is negligible and related to random noise or to measurement accuracy limitations. When both the time difference and the value difference between the current and the previous sample are small, it may be preferable to ignore (not to add) the new measurement.
</p>
<p>
<code>
JSON
</code>
: Introduces a fix to avoid duplicating AOF commands multiple times in
<code>
JSON.MSET
</code>
.
</p>
<p>
<code>
Probabilistic
</code>
: Now, an error is returned if
<code>
CMS.MERGE
</code>
results in an overflow or underflow.
</p>
<p>
<strong>
Search and query
</strong>
</p>
<ul>
<li>
New
<code>
BFLOAT16
</code>
and
<code>
FLOAT16
</code>
vector data types reduce memory consumed by vectors while preserving accuracy.
</li>
<li>
Support for indexing empty and missing values and enhanced developer experience for queries with exact matching capabilities.
</li>
<li>
Developers can now match
<code>
TAG
</code>
fields without needing to escape special characters, making the onboarding process and use of the query syntax simpler.
</li>
<li>
Geospatial search capabilities have been expanded with new
<code>
INTERSECT
</code>
and
<code>
DISJOINT
</code>
operators, and ergonomics have been improved by providing better reporting of the memory consumed by the index and exposing the Full-text scoring in the aggregation pipeline.
</li>
</ul>
<p>
<strong>
Removal of triggers and functions
</strong>
</p>
<p>
Redis Stack 7.4 will no longer include triggers and functions. To ensure a seamless upgrade, remove any T&F functions created before loading an RDB file into the new Redis Stack.
</p>
<h3 id="details-1">
Details
</h3>
<p>
Find more details about features and optimizations introduced with Redis Stack 7.4 here:
</p>
<ul>
<li>
<a href="https://github.com/redis/redis/blob/7.4.0/00-RELEASENOTES">
Redis server
</a>
</li>
<li>
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.10.5">
Search and query capability
</a>
</li>
<li>
<a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.8.3">
JSON data structure
</a>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.12.2">
Time series data structure
</a>
</li>
<li>
<a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.8.2">
Probabilistic data structures
</a>
</li>
</ul>
<p>
<strong>
Redis version
</strong>
</p>
<ul>
<li>
<a href="https://github.com/redis/redis/releases/tag/7.4.0">
Redis 7.4.0
</a>
</li>
</ul>
<p>
<strong>
Module versions
</strong>
</p>
<ul>
<li>
<a href="https://github.com/RediSearch/RediSearch/releases/tag/v2.10.5">
RediSearch 2.10.5
</a>
</li>
<li>
<a href="https://github.com/RedisJSON/RedisJSON/releases/tag/v2.8.3">
RedisJSON 2.8.3
</a>
</li>
<li>
<a href="https://github.com/RedisTimeSeries/RedisTimeSeries/releases/tag/v1.12.2">
RedisTimeSeries 1.12.2
</a>
</li>
<li>
<a href="https://github.com/RedisBloom/RedisBloom/releases/tag/v2.8.2">
RedisBloom 2.8.2
</a>
</li>
</ul>
<p>
<strong>
Recommended client libraries
</strong>
</p>
<ul>
<li>
Java
<ul>
<li>
<a href="https://github.com/redis/jedis/releases/tag/v5.1.4">
Jedis 5.1.4 or later
</a>
</li>
<li>
<a href="https://github.com/redis/lettuce/releases/tag/6.4.0.RELEASE">
Lettuce 6.4.0 or later
</a>
</li>
</ul>
</li>
<li>
Python
<ul>
<li>
<a href="https://github.com/redis/redis-py/releases/tag/v5.0.8">
redis-py 5.0.8 or later
</a>
</li>
</ul>
</li>
<li>
NodeJS
<ul>
<li>
<a href="https://github.com/redis/node-redis/releases/tag/redis%404.7.0">
node-redis 4.7.0 or later
</a>
</li>
</ul>
</li>
<li>
Go
<ul>
<li>
<a href="https://github.com/redis/go-redis/releases/tag/v9.6.1">
go-redis 9.6.1 or later
</a>
</li>
</ul>
</li>
</ul>
<p>
Compatible with
<a href="https://redis.io/download">
Redis Insight
</a>
. The docker image redis/redis-stack for this version is bundled with
<a href="https://github.com/RedisInsight/RedisInsight/releases/tag/2.52.0">
Redis Insight 2.52
</a>
.
</p>
<p>
Note: version numbers follow the pattern:
</p>
<p>
<code>
x.y.z-b
</code>
</p>
<ul>
<li>
<code>
x.y
</code>
Redis Major version
</li>
<li>
<code>
z
</code>
increases with even numbers as a module x.y version increases.
</li>
<li>
<code>
b
</code>
denotes a patch to Redis or a module (any
<code>
z
</code>
of Redis or modules).
<code>
b
</code>
will consist of a
<code>
v
</code>
+ numeric value.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/oss_and_stack/stack-with-enterprise/release-notes/redisstack/redisstack-7.4-release-notes/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/databases/auto-tiering/storage-engine/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage Auto Tiering storage engine
</h1>
<p class="text-lg -mt-5 mb-10">
Manage the storage engine used for your database with auto tiering enabled.
</p>
<h2 id="manage-the-storage-engine">
Manage the storage engine
</h2>
<p>
Redis Enterprise Auto Tiering supports two storage engines:
</p>
<ul>
<li>
<a href="https://www.speedb.io/">
Speedb
</a>
(default, recommended)
</li>
<li>
<a href="https://rocksdb.org/">
RocksDB
</a>
</li>
</ul>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
Switching between storage engines requires guidance by Redis Support or your Account Manager.
</div>
</div>
<h3 id="change-the-storage-engine">
Change the storage engine
</h3>
<ol>
<li>
Change the cluster level configuration for default storage engine.
</li>
</ol>
<ul>
<li>
<p>
API:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <username>:<password> -X PUT -H <span class="s2">"Content-Type: application/json"</span> -d <span class="s1">'{"bigstore_driver":"speedb"}'</span> https://localhost:9443/v1/cluster
</span></span></code></pre>
</div>
</li>
<li>
<p>
CLI:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin cluster config bigstore_driver <span class="o">{</span>speedb <span class="p">|</span> rocksdb<span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ul>
<ol start="2">
<li>
<p>
Restart the each database on the cluster one by one.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin restart db <span class="o">{</span> db:<id> <span class="p">|</span> <name> <span class="o">}</span>
</span></span></code></pre>
</div>
</li>
</ol>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
We recommend restarting your database at times with low usage and avoiding peak hours. For databases without persistence enabled, we also recommend using export to backup your database first.
</div>
</div>
<h2 id="monitor-the-storage-engine">
Monitor the storage engine
</h2>
<p>
To get the current cluster level default storage engine run:
</p>
<ul>
<li>
<p>
Use the
<code>
rladmin info cluster
</code>
command look for ‘bigstore_driver’.
</p>
</li>
<li>
<p>
Use the REST API:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">curl -k -u <username>:<password> -X GET -H <span class="s2">"Content-Type: application/json"</span> https://localhost:9443/v1/cluster
</span></span></code></pre>
</div>
</li>
</ul>
<p>
Versions of Redis Enterprise 7.2 and later provide a metric called
<code>
bdb_bigstore_shard_count
</code>
to help track the shard count per database, filtered by
<code>
bdb_id
</code>
and by storage engine as shown below:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">bdb_bigstore_shard_count<span class="o">{</span><span class="nv">bdb</span><span class="o">=</span><span class="s2">"1"</span>,cluster<span class="o">=</span><span class="s2">"mycluster.local"</span>,driver<span class="o">=</span><span class="s2">"rocksdb"</span><span class="o">}</span> 1.0
</span></span><span class="line"><span class="cl">bdb_bigstore_shard_count<span class="o">{</span><span class="nv">bdb</span><span class="o">=</span><span class="s2">"1"</span>,cluster<span class="o">=</span><span class="s2">"mycluster.local"</span>,driver<span class="o">=</span><span class="s2">"speedb"</span><span class="o">}</span> 2.0
</span></span></code></pre>
</div>
<p>
For more about metrics for Redis Enterprise’s integration with Prometheus, see
<a href="/docs/latest/integrate/prometheus-with-redis-enterprise/prometheus-metrics-definitions/">
Prometheus integration
</a>
.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/databases/auto-tiering/storage-engine/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/databases/configure/db-tags/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Manage database tags
</h1>
<p class="text-lg -mt-5 mb-10">
Manage tags for databases in a Redis Software cluster.
</p>
<p>
You can create custom tags to categorize databases in a Redis Software cluster.
</p>
<p>
The
<strong>
Databases
</strong>
screen shows tags for each database in the list.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/view-db-list-tags.png" sdata-lightbox="/images/rs/screenshots/databases/view-db-list-tags.png">
<img alt="The databases screen includes tags for each database." src="/docs/latest/images/rs/screenshots/databases/view-db-list-tags.png"/>
</a>
<h2 id="add-database-tags">
Add database tags
</h2>
<p>
You can add tags when you
<a href="/docs/latest/operate/rs/databases/create/">
create a database
</a>
or
<a href="/docs/latest/operate/rs/databases/configure/#edit-database-settings">
edit an existing database's configuration
</a>
.
</p>
<p>
To add tags to a database using the Cluster Manager UI:
</p>
<ol>
<li>
<p>
While in edit mode on the database's configuration screen, click
<strong>
Add tags
</strong>
.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/add-db-tags-button.png" sdata-lightbox="/images/rs/screenshots/databases/add-db-tags-button.png">
<img alt="The Add tags button on the database configuration screen." src="/docs/latest/images/rs/screenshots/databases/add-db-tags-button.png"/>
</a>
</li>
<li>
<p>
Enter a key and value for the tag. Keys and values previously used by existing tags will appear as suggestions.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/manage-db-tags-dialog-suggestions.png" sdata-lightbox="/images/rs/screenshots/databases/manage-db-tags-dialog-suggestions.png">
<img alt="The Manage tags dialog lets you add, edit, or delete tags." src="/docs/latest/images/rs/screenshots/databases/manage-db-tags-dialog-suggestions.png"/>
</a>
</li>
<li>
<p>
To add additional tags, click
<strong>
Add tag
</strong>
.
</p>
</li>
<li>
<p>
After you finish adding tags, click
<strong>
Done
</strong>
to close the tag manager.
</p>
</li>
<li>
<p>
Click
<strong>
Create
</strong>
or
<strong>
Save
</strong>
.
</p>
</li>
</ol>
<h2 id="edit-database-tags">
Edit database tags
</h2>
<p>
To edit a database's existing tags using the Cluster Manager UI:
</p>
<ol>
<li>
<p>
Go to the database's
<strong>
Configuration
</strong>
screen, then click
<strong>
Edit
</strong>
.
</p>
</li>
<li>
<p>
Next to the existing
<strong>
Tags
</strong>
, click
<a href="/docs/latest/images/rs/buttons/edit-db-tags-button.png#no-click" sdata-lightbox="/images/rs/buttons/edit-db-tags-button.png#no-click">
<img alt="Edit tags button" class="inline" src="/docs/latest/images/rs/buttons/edit-db-tags-button.png#no-click" width="22px"/>
</a>
.
</p>
<a href="/docs/latest/images/rs/screenshots/databases/edit-db-tags-button-location.png" sdata-lightbox="/images/rs/screenshots/databases/edit-db-tags-button-location.png">
<img alt="The Edit tags button on the database configuration screen." src="/docs/latest/images/rs/screenshots/databases/edit-db-tags-button-location.png"/>
</a>
</li>
<li>
<p>
Edit or delete existing tags, or click
<strong>
Add tag
</strong>
to add new tags.
</p>
</li>
<li>
<p>
After you finish editing tags, click
<strong>
Done
</strong>
to close the tag manager.
</p>
</li>
<li>
<p>
Click
<strong>
Save
</strong>
.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/databases/configure/db-tags/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/query-use-cases/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Use cases
</h1>
<p class="text-lg -mt-5 mb-10">
Redis Query Engine use cases
</p>
<p>
<strong>
Application search and external secondary index
</strong>
</p>
<p>
Redis Stack supports application search, whether the source of record is Redis or another database. In the latter case, you can use Redis Stack as an external secondary index for numeric or full-text data.
</p>
<p>
<strong>
Secondary index for Redis data
</strong>
</p>
<p>
You can represent your data model using Redis hashes and JSON documents. You can then declare secondary indexes to support various queries on your data set. Redis Stack updates indexes automatically whenever a hash or JSON document that matches the indexes is added or updated.
</p>
<p>
<strong>
Geo-distributed search
</strong>
</p>
<p>
In geo-distributed search, hashes and JSON documents are handled in the usual
<a href="https://docs.redis.com/latest/rs/databases/active-active/">
active-active manner
</a>
. The index follows whatever is written in the documents in the database. Create an index on each database, then add synonyms (if used) to each database.
</p>
<p>
<strong>
Unified search
</strong>
</p>
<p>
You can use Redis Stack to search across several source systems, like file servers, content management systems (CMS), or customer relationship management (CRM) systems. You can process source data in batches using, for example, ETL tools, or as live streams (e.g., Kafka or Redis streams).
</p>
<p>
<strong>
Analytics
</strong>
</p>
<p>
Data often originates from several source systems. Redis Stack can provide a unified view of dimensions and facts. You can query data based on dimensions, group by dimension, and apply aggregations to facts.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Redis Stack for faceted search:
</div>
Facets are multiple explicit dimensions implemented as tags in RediSearch. You can query data based on facets using aggregations (
<code>
COUNT
</code>
,
<code>
TOLIST
</code>
,
<code>
FIRST_VALUE
</code>
, and
<code>
RANDOM_SAMPLE
</code>
).
</div>
</div>
<p>
<strong>
Ephemeral search (retail)
</strong>
</p>
<p>
When the user logs on to the site, the purchase-search history is populated into an index from another datastore. This requires lightweight index creation, index expiry, and quick document indexing.
</p>
<p>
The application/service creates a temporary and user-specific, full-text index when a user logs in. The application/service has direct access to the user-specific index and the primary datastore. When the user logs out of the service, the index is explicitly removed. Otherwise, the index expires after a while (for example, after the user's session expires).
</p>
<p>
Using Redis Stack for this type of application provides these benefits:
</p>
<ul>
<li>
Search index is only populated when needed.
</li>
<li>
Only a small portion (for example, 2%) of users are active at the same time.
</li>
<li>
Users are only active for a short period of time.
</li>
<li>
A small number of documents are indexed, which is very cost effective in comparison to a persistent search index.
</li>
</ul>
<p>
<strong>
Real-time inventory (retail)
</strong>
</p>
<p>
In real-time inventory retail, the key question is product availability: "What is available where?" The challenges with such projects are performance and accuracy. Redis Stack allows for real-time searching and aggregations over millions of store/SKU combinations.
</p>
<p>
You can establish real-time event capture from a legacy inventory system to Redis Stack and then have several inventory services query it. Then, you can use combined queries such as item counts, price ranges, categories, and locations. Take advantage of geo-distributed search (Active-Active) for your remote store locations.
</p>
<p>
Using Redis Stack for this type of application provides these benefits:
</p>
<ul>
<li>
Low-latency queries for downstream consumers like marketing, stores/e-commerce, and fulfillment
</li>
<li>
Immediate and higher consistency between stores and data-centers
</li>
<li>
Improved customer experience
</li>
<li>
Real-time pricing decisions
</li>
<li>
Less shopping cart abandonment
</li>
<li>
Less remediation (refund, cancellation)
</li>
</ul>
<p>
<strong>
Real-time conversation analysis (telecom)
</strong>
</p>
<p>
Collect, access, store, and utilize communication data in real time. Capture network traffic and store it in a full-text index for the purposes of getting insights into the data.
</p>
<p>
Gather data using connection information gathering (source IPs, DNS) and conversation data gathering (Wireshark/TShark live capture). Then filter, transform, and store the conversation data in Redis to perform search queries and create custom dashboards for your analyses.
</p>
<p>
Using Redis Stack for this type of application provides these benefits:
</p>
<ul>
<li>
Insights into performance issues, security threats, and network faults
</li>
<li>
Improved service uptime and security
</li>
</ul>
<p>
<strong>
Research portal (academia)
</strong>
</p>
<p>
Research portals let users search for articles, research, specifications, past solutions, and data to answer specific questions and take advantage of existing knowledge and history.
</p>
<p>
To build such a system, you can use indexes supporting tag queries, numeric range queries, geo-location queries, and full-text search.
</p>
<p>
Using Redis Stack for this type of application provides these benefits:
</p>
<ul>
<li>
Create relevant, personalized search experiences while enforcing internal and regulatory data governance policies
</li>
<li>
Increased productivity, security, and compliance
</li>
</ul>
<nav>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/query-use-cases/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/develop/interact/search-and-query/query/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Query data
</h1>
<p class="text-lg -mt-5 mb-10">
Understand how to query, search, and aggregate Redis data
</p>
<p>
Redis Stack distinguishes between the
<a href="/docs/latest/commands/ft.search">
FT.SEARCH
</a>
and
<a href="/docs/latest/commands/ft.aggregate">
FT.AGGREGATE
</a>
query commands. You should use
<a href="/docs/latest/commands/ft.search">
FT.SEARCH
</a>
if you want to perform selections and projections only. If you also need to apply mapping functions, group, or aggregate data, use the
<a href="/docs/latest/commands/ft.aggregate">
FT.AGGREGATE
</a>
command.
</p>
<ul>
<li>
<strong>
Selection
</strong>
: A selection allows you to return all documents that fulfill specific criteria.
</li>
<li>
<strong>
Projection
</strong>
: Projections are used to return specific fields of the result set. You can also map/project to calculated field values.
</li>
<li>
<strong>
Aggregation
</strong>
: Aggregations collect and summarize data across several fields.
</li>
</ul>
<p>
Here is a short SQL comparison using the
<a href="./data/bicycles.txt">
bicycle dataset
</a>
:
</p>
<table>
<thead>
<tr>
<th>
Type
</th>
<th>
SQL
</th>
<th>
Redis Stack
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Selection
</td>
<td>
<code>
SELECT * FROM bicycles WHERE price >= 1000
</code>
</td>
<td>
<code>
FT.SEARCH idx:bicycle "@price:[1000 +inf]"
</code>
</td>
</tr>
<tr>
<td>
Simple projection
</td>
<td>
<code>
SELECT id, price FROM bicycles
</code>
</td>
<td>
<code>
FT.SEARCH idx:bicycle "*" RETURN 2 __key, price
</code>
</td>
</tr>
<tr>
<td>
Calculated projection
</td>
<td>
<code>
SELECT id, price-price*0.1 AS discounted FROM bicycles
</code>
</td>
<td>
<code>
FT.AGGREGATE idx:bicycle "*" LOAD 2 __key price APPLY "@price-@price*0.1" AS discounted
</code>
</td>
</tr>
<tr>
<td>
Aggregation
</td>
<td>
<code>
SELECT condition, AVG(price) AS avg_price FROM bicycles GROUP BY condition
</code>
</td>
<td>
<code>
FT.AGGREGATE idx:bicycle "*" GROUPBY 1 @condition REDUCE AVG 1 @price AS avg_price
</code>
</td>
</tr>
</tbody>
</table>
<p>
The following articles provide an overview of how to query data with the
<a href="/docs/latest/commands/ft.search">
FT.SEARCH
</a>
command:
</p>
<ul>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/exact-match/">
Exact match queries
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/range/">
Range queries
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/full-text/">
Full-text search
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/geo-spatial/">
Geospatial queries
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/vector-search/">
Vector search
</a>
</li>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/combined/">
Combined queries
</a>
</li>
</ul>
<p>
You can find further details about aggregation queries with
<a href="/docs/latest/commands/ft.aggregate">
FT.AGGREGATE
</a>
in the following article:
</p>
<ul>
<li>
<a href="/docs/latest/develop/interact/search-and-query/query/aggregation/">
Aggregation queries
</a>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/develop/interact/search-and-query/query/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/xadd/.html | <section class="prose w-full py-12">
<h1 class="command-name">
XADD
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">XADD key [NOMKSTREAM] [<MAXLEN | MINID> [= | ~] threshold
[LIMIT count]] <* | id> field value [field value ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
5.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1) when adding a new entry, O(N) when trimming where N being the number of entries evicted.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@write
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@stream
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Appends the specified stream entry to the stream at the specified key.
If the key does not exist, as a side effect of running this command the
key is created with a stream value. The creation of stream's key can be
disabled with the
<code>
NOMKSTREAM
</code>
option.
</p>
<p>
An entry is composed of a list of field-value pairs.
The field-value pairs are stored in the same order they are given by the user.
Commands that read the stream, such as
<a href="/docs/latest/commands/xrange/">
<code>
XRANGE
</code>
</a>
or
<a href="/docs/latest/commands/xread/">
<code>
XREAD
</code>
</a>
, are guaranteed to return the fields and values exactly in the same order they were added by
<code>
XADD
</code>
.
</p>
<p>
<code>
XADD
</code>
is the
<em>
only Redis command
</em>
that can add data to a stream, but
there are other commands, such as
<a href="/docs/latest/commands/xdel/">
<code>
XDEL
</code>
</a>
and
<a href="/docs/latest/commands/xtrim/">
<code>
XTRIM
</code>
</a>
, that are able to
remove data from a stream.
</p>
<h2 id="specifying-a-stream-id-as-an-argument">
Specifying a Stream ID as an argument
</h2>
<p>
A stream entry ID identifies a given entry inside a stream.
</p>
<p>
The
<code>
XADD
</code>
command will auto-generate a unique ID for you if the ID argument
specified is the
<code>
*
</code>
character (asterisk ASCII character). However, while
useful only in very rare cases, it is possible to specify a well-formed ID, so
that the new entry will be added exactly with the specified ID.
</p>
<p>
IDs are specified by two numbers separated by a
<code>
-
</code>
character:
</p>
<pre><code>1526919030474-55
</code></pre>
<p>
Both quantities are 64-bit numbers. When an ID is auto-generated, the
first part is the Unix time in milliseconds of the Redis instance generating
the ID. The second part is just a sequence number and is used in order to
distinguish IDs generated in the same millisecond.
</p>
<p>
You can also specify an incomplete ID, that consists only of the milliseconds part, which is interpreted as a zero value for sequence part.
To have only the sequence part automatically generated, specify the milliseconds part followed by the
<code>
-
</code>
separator and the
<code>
*
</code>
character:
</p>
<pre tabindex="0"><code>> XADD mystream 1526919030474-55 message "Hello,"
"1526919030474-55"
> XADD mystream 1526919030474-* message " World!"
"1526919030474-56"
</code></pre>
<p>
IDs are guaranteed to be always incremental: If you compare the ID of the
entry just inserted it will be greater than any other past ID, so entries
are totally ordered inside a stream. In order to guarantee this property,
if the current top ID in the stream has a time greater than the current
local time of the instance, the top entry time will be used instead, and
the sequence part of the ID incremented. This may happen when, for instance,
the local clock jumps backward, or if after a failover the new master has
a different absolute time.
</p>
<p>
When a user specified an explicit ID to
<code>
XADD
</code>
, the minimum valid ID is
<code>
0-1
</code>
, and the user
<em>
must
</em>
specify an ID which is greater than any other
ID currently inside the stream, otherwise the command will fail and return an error. Usually
resorting to specific IDs is useful only if you have another system generating
unique IDs (for instance an SQL table) and you really want the Redis stream
IDs to match the one of this other system.
</p>
<h2 id="capped-streams">
Capped streams
</h2>
<p>
<code>
XADD
</code>
incorporates the same semantics as the
<a href="/docs/latest/commands/xtrim/">
<code>
XTRIM
</code>
</a>
command - refer to its documentation page for more information.
This allows adding new entries and keeping the stream's size in check with a single call to
<code>
XADD
</code>
, effectively capping the stream with an arbitrary threshold.
Although exact trimming is possible and is the default, due to the internal representation of steams it is more efficient to add an entry and trim stream with
<code>
XADD
</code>
using
<strong>
almost exact
</strong>
trimming (the
<code>
~
</code>
argument).
</p>
<p>
For example, calling
<code>
XADD
</code>
in the following form:
</p>
<pre><code>XADD mystream MAXLEN ~ 1000 * ... entry fields here ...
</code></pre>
<p>
Will add a new entry but will also evict old entries so that the stream will contain only 1000 entries, or at most a few tens more.
</p>
<h2 id="additional-information-about-streams">
Additional information about streams
</h2>
<p>
For further information about Redis streams please check our
<a href="/docs/latest/develop/data-types/streams/">
introduction to Redis Streams document
</a>
.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> XADD mystream * name Sara surname OConnor
"1731594213185-0"
redis> XADD mystream * field1 value1 field2 value2 field3 value3
"1731594213186-0"
redis> XLEN mystream
(integer) 2
redis> XRANGE mystream - +
1) 1) "1731594213185-0"
2) 1) "name"
2) "Sara"
3) "surname"
4) "OConnor"
2) 1) "1731594213186-0"
2) 1) "field1"
2) "value1"
3) "field2"
4) "value2"
5) "field3"
6) "value3"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Bulk string reply
</a>
: The ID of the added entry. The ID is the one automatically generated if an asterisk (
<code>
*
</code>
) is passed as the
<em>
id
</em>
argument, otherwise the command just returns the same ID specified by the user during insertion.
</li>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Nil reply
</a>
: if the NOMKSTREAM option is given and the key doesn't exist.
</li>
</ul>
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<p>
One of the following:
</p>
<ul>
<li>
<a href="../../develop/reference/protocol-spec#bulk-strings">
Bulk string reply
</a>
: The ID of the added entry. The ID is the one automatically generated if an asterisk (
<code>
*
</code>
) is passed as the
<em>
id
</em>
argument, otherwise the command just returns the same ID specified by the user during insertion.
</li>
<li>
<a href="../../develop/reference/protocol-spec#nulls">
Null reply
</a>
: if the NOMKSTREAM option is given and the key doesn't exist.
</li>
</ul>
<br/>
<h2>
History
</h2>
<ul>
<li>
Starting with Redis version 6.2.0: Added the
<code>
NOMKSTREAM
</code>
option,
<code>
MINID
</code>
trimming strategy and the
<code>
LIMIT
</code>
option.
</li>
<li>
Starting with Redis version 7.0.0: Added support for the
<code>
<ms>-*
</code>
explicit ID form.
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/xadd/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/task/list/.html | <section class="prose w-full py-12 max-w-none">
<h1>
crdb-cli task list
</h1>
<p class="text-lg -mt-5 mb-10">
Lists active and recent Active-Active database tasks.
</p>
<p>
Lists active and recent Active-Active database tasks.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">crdb-cli task list
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<p>
None
</p>
<h3 id="returns">
Returns
</h3>
<p>
A table listing current and recent Active-Active tasks. Each entry includes the following:
</p>
<table>
<thead>
<tr>
<th>
Column
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Task ID
</td>
<td>
String containing the unique ID associated with the task
<br/>
Example:
<code>
e1c49470-ae0b-4df8-885b-9c755dd614d0
</code>
</td>
</tr>
<tr>
<td>
CRDB-GUID
</td>
<td>
String containing the unique ID associated with the Active-Active database affected by the task
<br/>
Example:
<code>
1d7741cc-1110-4e2f-bc6c-935292783d24
</code>
</td>
</tr>
<tr>
<td>
Operation
</td>
<td>
String describing the task action
<br/>
Example:
<code>
create_crdb
</code>
</td>
</tr>
<tr>
<td>
Status
</td>
<td>
String indicating the task status
<br/>
Example:
<code>
finished
</code>
</td>
</tr>
<tr>
<td>
Worker name
</td>
<td>
String identifying the process handling the task
<br/>
Example:
<code>
crdb_worker:1:0
</code>
</td>
</tr>
<tr>
<td>
Started
</td>
<td>
TimeStamp value indicating when the task started (
<a href="https://en.wikipedia.org/wiki/Coordinated_Universal_Time">
UTC
</a>
)
<br/>
Example:
<code>
2022-10-12T09:33:41Z
</code>
</td>
</tr>
<tr>
<td>
Ended
</td>
<td>
TimeStamp value indicating when the task ended (UTC)
<br/>
Example:
<code>
2022-10-12T09:33:55Z
</code>
</td>
</tr>
</tbody>
</table>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ crdb-cli task list
</span></span><span class="line"><span class="cl">TASK-ID CRDB-GUID OPERATION STATUS WORKER-NAME STARTED ENDED
</span></span><span class="line"><span class="cl"><task-ID> <crdb-ID> <operation> <result> <worker-ID> <started> <ended>
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/task/list/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/references/rest-api/objects/cluster/alert_settings/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Alert settings object
</h1>
<p class="text-lg -mt-5 mb-10">
Documents the alert_settings object used with Redis Enterprise Software REST API calls.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
cluster_certs_about_to_expire
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Cluster certificate will expire in x days
</td>
</tr>
<tr>
<td>
cluster_even_node_count
</td>
<td>
boolean (default: false)
</td>
<td>
True high availability requires an odd number of nodes in the cluster
</td>
</tr>
<tr>
<td>
cluster_flash_overcommit
</td>
<td>
boolean (default: false)
</td>
<td>
Flash memory committed to databases is larger than cluster total flash memory
</td>
</tr>
<tr>
<td>
cluster_inconsistent_redis_sw
</td>
<td>
boolean (default: false)
</td>
<td>
Some shards in the cluster are running different versions of Redis software
</td>
</tr>
<tr>
<td>
cluster_inconsistent_rl_sw
</td>
<td>
boolean (default: false)
</td>
<td>
Some nodes in the cluster are running different versions of Redis Enterprise software
</td>
</tr>
<tr>
<td>
cluster_internal_bdb
</td>
<td>
boolean (default: false)
</td>
<td>
Issues with internal cluster databases
</td>
</tr>
<tr>
<td>
cluster_license_about_to_expire
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Cluster license will expire in x days. This alert is enabled by default. Its default threshold is 7 days before license expiration.
</td>
</tr>
<tr>
<td>
cluster_multiple_nodes_down
</td>
<td>
boolean (default: false)
</td>
<td>
Multiple cluster nodes are down (this might cause data loss)
</td>
</tr>
<tr>
<td>
cluster_node_joined
</td>
<td>
boolean (default: false)
</td>
<td>
New node joined the cluster
</td>
</tr>
<tr>
<td>
cluster_node_remove_abort_completed
</td>
<td>
boolean (default: false)
</td>
<td>
Cancel node remove operation completed
</td>
</tr>
<tr>
<td>
cluster_node_remove_abort_failed
</td>
<td>
boolean (default: false)
</td>
<td>
Cancel node remove operation failed
</td>
</tr>
<tr>
<td>
cluster_node_remove_completed
</td>
<td>
boolean (default: false)
</td>
<td>
Node removed from the cluster
</td>
</tr>
<tr>
<td>
cluster_node_remove_failed
</td>
<td>
boolean (default: false)
</td>
<td>
Failed to remove a node from the cluster
</td>
</tr>
<tr>
<td>
cluster_ocsp_query_failed
</td>
<td>
boolean (default: false)
</td>
<td>
Failed to query the OCSP server
</td>
</tr>
<tr>
<td>
cluster_ocsp_status_revoked
</td>
<td>
boolean (default: false)
</td>
<td>
OCSP certificate status is REVOKED
</td>
</tr>
<tr>
<td>
cluster_ram_overcommit
</td>
<td>
boolean (default: false)
</td>
<td>
RAM committed to databases is larger than cluster total RAM
</td>
</tr>
<tr>
<td>
cluster_too_few_nodes_for_replication
</td>
<td>
boolean (default: false)
</td>
<td>
Replication requires at least 2 nodes in the cluster
</td>
</tr>
<tr>
<td>
node_aof_slow_disk_io
</td>
<td>
boolean (default: false)
</td>
<td>
AOF reaching disk I/O limits
</td>
</tr>
<tr>
<td>
node_checks_error
</td>
<td>
boolean (default: false)
</td>
<td>
Some node checks have failed
</td>
</tr>
<tr>
<td>
node_cpu_utilization
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node CPU utilization has reached the threshold value (% of the utilization limit)
</td>
</tr>
<tr>
<td>
node_ephemeral_storage
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node ephemeral storage has reached the threshold value (% of the storage limit)
</td>
</tr>
<tr>
<td>
node_failed
</td>
<td>
boolean (default: false)
</td>
<td>
Node failed
</td>
</tr>
<tr>
<td>
node_free_flash
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node flash storage has reached the threshold value (% of the storage limit)
</td>
</tr>
<tr>
<td>
node_insufficient_disk_aofrw
</td>
<td>
boolean (default: false)
</td>
<td>
Insufficient AOF disk space
</td>
</tr>
<tr>
<td>
node_internal_certs_about_to_expire
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Internal certificate on node will expire in x days
</td>
</tr>
<tr>
<td>
node_memory
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node memory has reached the threshold value (% of the memory limit)
</td>
</tr>
<tr>
<td>
node_net_throughput
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node network throughput has reached the threshold value (bytes/s)
</td>
</tr>
<tr>
<td>
node_persistent_storage
</td>
<td>
<span class="break-all">
<a href="/docs/latest/operate/rs/references/rest-api/objects/cluster/cluster_alert_settings_with_threshold/">
cluster_alert_settings_with_threshold
</a>
</span>
object
</td>
<td>
Node persistent storage has reached the threshold value (% of the storage limit)
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/references/rest-api/objects/cluster/alert_settings/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di-upgrade/.html | <section class="prose w-full py-12 max-w-none">
<h1>
redis-di upgrade
</h1>
<p class="text-lg -mt-5 mb-10">
Upgrades Write-behind Engine without losing data or downtime
</p>
<h2 id="usage">
Usage
</h2>
<pre tabindex="0"><code>Usage: redis-di upgrade [OPTIONS]
</code></pre>
<h2 id="options">
Options
</h2>
<ul>
<li>
<p>
<code>
loglevel
</code>
:
</p>
<ul>
<li>
Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'])
</li>
<li>
Default:
<code>
info
</code>
</li>
<li>
Usage:
<code>
--loglevel -log-level
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
cluster_host
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-host
</code>
</li>
</ul>
<p>
Host/IP of Redis Enterprise Cluster (service name in case of k8s)
</p>
</li>
<li>
<p>
<code>
cluster_api_port
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: <IntRange 1000<=x<=65535>
</li>
<li>
Default:
<code>
9443
</code>
</li>
<li>
Usage:
<code>
--cluster-api-port
</code>
</li>
</ul>
<p>
API Port of Redis Enterprise Cluster
</p>
</li>
<li>
<p>
<code>
cluster_user
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-user
</code>
</li>
</ul>
<p>
Redis Enterprise Cluster username with either DB Member, Cluster Member or Cluster Admin roles
</p>
</li>
<li>
<p>
<code>
cluster_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--cluster-password
</code>
</li>
</ul>
<p>
Redis Enterprise Cluster Password
</p>
</li>
<li>
<p>
<code>
rdi_host
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-host
</code>
</li>
</ul>
<p>
Host/IP of Write-behind Database
</p>
</li>
<li>
<p>
<code>
rdi_port
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: <IntRange 1000<=x<=65535>
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-port
</code>
</li>
</ul>
<p>
Port of Write-behind Database
</p>
</li>
<li>
<p>
<code>
rdi_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-password
</code>
</li>
</ul>
<p>
Write-behind Database Password
</p>
</li>
<li>
<p>
<code>
rdi_key
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key
</code>
</li>
</ul>
<p>
Private key file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cert
</code>
</li>
</ul>
<p>
Client certificate file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cacert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cacert
</code>
</li>
</ul>
<p>
CA certificate file to verify with
</p>
</li>
<li>
<p>
<code>
rdi_key_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key-password
</code>
</li>
</ul>
<p>
Password for unlocking an encrypted private key
</p>
</li>
<li>
<p>
<code>
force
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--force -f
</code>
</li>
</ul>
<p>
Force upgrade/downgrade. skips verification prompts
</p>
</li>
<li>
<p>
<code>
help
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--help
</code>
</li>
</ul>
<p>
Show this message and exit.
</p>
</li>
</ul>
<h2 id="cli-help">
CLI help
</h2>
<pre tabindex="0"><code>Usage: redis-di upgrade [OPTIONS]
Upgrades Write-behind Engine without losing data or downtime
Options:
-log-level, --loglevel [DEBUG|INFO|WARN|ERROR|CRITICAL]
[default: INFO]
--cluster-host TEXT Host/IP of Redis Enterprise Cluster (service
name in case of k8s) [required]
--cluster-api-port INTEGER RANGE
API Port of Redis Enterprise Cluster
[default: 9443; 1000<=x<=65535; required]
--cluster-user TEXT Redis Enterprise Cluster username with
either DB Member, Cluster Member or Cluster
Admin roles [required]
--cluster-password TEXT Redis Enterprise Cluster Password
--rdi-host TEXT Host/IP of Write-behind Database [required]
--rdi-port INTEGER RANGE Port of Write-behind Database [1000<=x<=65535;
required]
--rdi-password TEXT Write-behind Database Password
--rdi-key TEXT Private key file to authenticate with
--rdi-cert TEXT Client certificate file to authenticate with
--rdi-cacert TEXT CA certificate file to verify with
--rdi-key-password TEXT Password for unlocking an encrypted private
key
-f, --force Force upgrade/downgrade. skips verification
prompts
--help Show this message and exit.
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di-upgrade/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/cf.addnx.html | <section class="prose w-full py-12">
<h1 class="command-name">
CF.ADDNX
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">CF.ADDNX key item</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 1.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(k + i), where k is the number of sub-filters and i is maxIterations
</dd>
</dl>
<p>
Adds an item to a cuckoo filter if the item does not exist.
</p>
<p>
This command is similar to the combination of
<a href="/docs/latest/commands/cf.exists/">
<code>
CF.EXISTS
</code>
</a>
and
<a href="/docs/latest/commands/cf.add/">
<code>
CF.ADD
</code>
</a>
. It does not add an item into the filter if its fingerprint already exists.
</p>
<p>
<note>
<b>
Notes:
</b>
</note>
</p>
<ul>
<li>
This command is slower than
<a href="/docs/latest/commands/cf.add/">
<code>
CF.ADD
</code>
</a>
because it first checks whether the item exists.
</li>
<li>
Since
<a href="/docs/latest/commands/cf.exists/">
<code>
CF.EXISTS
</code>
</a>
can result in false positive,
<code>
CF.ADDNX
</code>
may not add an item because it is supposedly already exist, which may be wrong.
</li>
</ul>
<h2 id="required-arguments">
Required arguments
</h2>
<details open="">
<summary>
<code>
key
</code>
</summary>
<p>
is key name for a cuckoo filter to add items to.
</p>
<p>
If
<code>
key
</code>
does not exist - a new cuckoo filter is created.
</p>
</details>
<details open="">
<summary>
<code>
item
</code>
</summary>
<p>
is an item to add.
</p>
</details>
<h2 id="return-value">
Return value
</h2>
<p>
Returns one of these replies:
</p>
<ul>
<li>
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
, where
<code>
0
</code>
means that the item's fingerprint already exist in the filter, and
<code>
1
</code>
means that the item has been successfully added to the filter.
</li>
<li>
[] on error (invalid arguments, wrong key type, etc.) and also when the filter is full.
</li>
</ul>
<h2 id="examples">
Examples
</h2>
<div class="highlight">
<pre class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">redis> CF.ADDNX cf item
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">1</span>
</span></span><span class="line"><span class="cl">redis> CF.ADDNX cf item
</span></span><span class="line"><span class="cl"><span class="o">(</span>integer<span class="o">)</span> <span class="m">0</span></span></span></code></pre>
</div>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/cf.addnx/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/topk.count/.html | <section class="prose w-full py-12">
<h1 class="command-name">
TOPK.COUNT
<span class="text-base">
(deprecated)
</span>
</h1>
<div class="border-l-8 pl-4">
<p>
As of Bloom version 2.4, this command is regarded as deprecated.
</p>
</div>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TOPK.COUNT key item [item ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available in:
</dt>
<dd class="m-0">
<a href="/docs/stack">
Redis Stack
</a>
/
<a href="/docs/data-types/probabilistic">
Bloom 2.0.0
</a>
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(n) where n is the number of items
</dd>
</dl>
<p>
Returns count for an item.
Multiple items can be requested at once.
Please note this number will never be higher than the real count and likely to be lower.
</p>
<p>
This command has been deprecated. The count value is not a representative of
the number of appearances of an item.
</p>
<h3 id="parameters">
Parameters
</h3>
<ul>
<li>
<strong>
key
</strong>
: Name of sketch where item is counted.
</li>
<li>
<strong>
item
</strong>
: Item/s to be counted.
</li>
</ul>
<h2 id="return">
Return
</h2>
<p>
<a href="/docs/latest/develop/reference/protocol-spec/#arrays">
Array reply
</a>
of
<a href="/docs/latest/develop/reference/protocol-spec/#integers">
Integer reply
</a>
- count for responding item.
</p>
<h2 id="examples">
Examples
</h2>
<pre tabindex="0"><code>redis> TOPK.COUNT topk foo 42 nonexist
1) (integer) 3
2) (integer) 1
3) (integer) 0
</code></pre>
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/topk.count/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/help/.html | <section class="prose w-full py-12 max-w-none">
<h1>
rladmin help
</h1>
<p class="text-lg -mt-5 mb-10">
Shows available commands or specific command usage.
</p>
<p>
Lists all options and parameters for
<code>
rladmin
</code>
commands.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">rladmin <span class="nb">help</span> <span class="o">[</span>command<span class="o">]</span>
</span></span></code></pre>
</div>
<h3 id="parameters">
Parameters
</h3>
<table>
<thead>
<tr>
<th>
Parameter
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
command
</td>
<td>
Display help for this
<code>
rladmin
</code>
command (optional)
</td>
</tr>
</tbody>
</table>
<h3 id="returns">
Returns
</h3>
<p>
Returns a list of available
<code>
rladmin
</code>
commands.
</p>
<p>
If a
<code>
command
</code>
is specified, returns a list of all the options and parameters for that
<code>
rladmin
</code>
command.
</p>
<h3 id="example">
Example
</h3>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">$ rladmin <span class="nb">help</span>
</span></span><span class="line"><span class="cl">usage: rladmin <span class="o">[</span>options<span class="o">]</span> <span class="o">[</span>command<span class="o">]</span> <span class="o">[</span><span class="nb">command</span> args<span class="o">]</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Options:
</span></span><span class="line"><span class="cl"> -y Assume Yes <span class="k">for</span> all required user confirmations.
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Commands:
</span></span><span class="line"><span class="cl"> <span class="nb">bind</span> Bind an endpoint
</span></span><span class="line"><span class="cl"> cluster Cluster management commands
</span></span><span class="line"><span class="cl"> <span class="nb">exit</span> Exit admin shell
</span></span><span class="line"><span class="cl"> failover Fail-over master to slave
</span></span><span class="line"><span class="cl"> <span class="nb">help</span> Show available commands, or use <span class="nb">help</span> <command> <span class="k">for</span> a specific <span class="nb">command</span>
</span></span><span class="line"><span class="cl"> info Show information about tunable parameters
</span></span><span class="line"><span class="cl"> migrate Migrate elements between nodes
</span></span><span class="line"><span class="cl"> node Node management commands
</span></span><span class="line"><span class="cl"> placement Configure shards placement policy
</span></span><span class="line"><span class="cl"> recover Recover databases
</span></span><span class="line"><span class="cl"> restart Restart database shards
</span></span><span class="line"><span class="cl"> status Show status information
</span></span><span class="line"><span class="cl"> suffix Suffix management
</span></span><span class="line"><span class="cl"> tune Tune system parameters
</span></span><span class="line"><span class="cl"> upgrade Upgrade entity version
</span></span><span class="line"><span class="cl"> verify Cluster verification reports
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl">Use <span class="s2">"rladmin help [command]"</span> to get more information on a specific command.
</span></span></code></pre>
</div>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/help/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/pubsub-help/.html | <section class="prose w-full py-12">
<h1 class="command-name">
PUBSUB HELP
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">PUBSUB HELP</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
6.2.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
The
<code>
PUBSUB HELP
</code>
command returns a helpful text describing the different subcommands.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list of sub-commands and their descriptions.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/pubsub-help/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Database alerts settings object
</h1>
<p class="text-lg -mt-5 mb-10">
An object for database alerts configuration
</p>
<p>
An API object that represents the database alerts configuration.
</p>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Type/Value
</th>
<th>
Description
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
bdb_backup_delayed
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Periodic backup has been delayed for longer than specified threshold value (minutes)
</td>
</tr>
<tr>
<td>
bdb_crdt_src_high_syncer_lag
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
CRDB source sync lag is higher than specified threshold value (seconds)
</td>
</tr>
<tr>
<td>
bdb_crdt_src_syncer_connection_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
CRDB source sync had a connection error while trying to connect to replica source
</td>
</tr>
<tr>
<td>
bdb_crdt_src_syncer_general_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
CRDB sync encountered in general error
</td>
</tr>
<tr>
<td>
bdb_high_latency
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Latency is higher than specified threshold value (microsec)
</td>
</tr>
<tr>
<td>
bdb_high_syncer_lag
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of sync lag is higher than specified threshold value (seconds) (deprecated as of Redis Enterprise v5.0.1)
</td>
</tr>
<tr>
<td>
bdb_high_throughput
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Throughput is higher than specified threshold value (requests / sec)
</td>
</tr>
<tr>
<td>
bdb_long_running_action
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
An alert for state machines that are running for too long
</td>
</tr>
<tr>
<td>
bdb_low_throughput
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Throughput is lower than specified threshold value (requests / sec)
</td>
</tr>
<tr>
<td>
bdb_ram_dataset_overhead
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Dataset RAM overhead of a shard has reached the threshold value (% of its RAM limit)
</td>
</tr>
<tr>
<td>
bdb_ram_values
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Percent of values kept in a shard's RAM is lower than (% of its key count)
</td>
</tr>
<tr>
<td>
bdb_replica_src_high_syncer_lag
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of source sync lag is higher than specified threshold value (seconds)
</td>
</tr>
<tr>
<td>
bdb_replica_src_syncer_connection_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of source sync has connection error while trying to connect replica source
</td>
</tr>
<tr>
<td>
bdb_replica_src_syncer_general_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of sync encountered in general error
</td>
</tr>
<tr>
<td>
bdb_shard_num_ram_values
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Number of values kept in a shard's RAM is lower than (values)
</td>
</tr>
<tr>
<td>
bdb_size
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Dataset size has reached the threshold value (% of the memory limit)
</td>
</tr>
<tr>
<td>
bdb_syncer_connection_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of sync has connection error while trying to connect replica source (deprecated as of Redis Enterprise v5.0.1)
</td>
</tr>
<tr>
<td>
bdb_syncer_general_error
</td>
<td>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/bdb_alert_settings_with_threshold/">
bdb_alert_settings_with_threshold
</a>
object
</td>
<td>
Replica of sync encountered in general error (deprecated as of Redis Enterprise v5.0.1)
</td>
</tr>
</tbody>
</table>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/references/rest-api/objects/db_alerts_settings/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/redisinsight/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Insight
</h1>
<p class="text-lg -mt-5 mb-10">
Install and manage Redis Insight
</p>
<p>
For information on using Redis Insight, see
<a href="/docs/latest/develop/tools/insight/">
these pages
</a>
.
</p>
<nav>
<a href="/docs/latest/operate/redisinsight/install/">
Install Redis Insight
</a>
<p>
Install Redis Insight on AWS, Docker, Kubernetes, and desktop
</p>
<a href="/docs/latest/operate/redisinsight/configuration/">
Redis Insight configuration settings
</a>
<br/>
<br/>
<a href="/docs/latest/operate/redisinsight/proxy/">
Subpath proxy
</a>
<br/>
<br/>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/redisinsight/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rc/subscriptions/view-essentials-subscription/essentials-plan-details/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Redis Cloud Essentials plans
</h1>
<p class="text-lg -mt-5 mb-10">
Provides detailed information on Redis Cloud Essentials plans
</p>
<p>
Redis Cloud Essentials is cost-efficient and designed for low-throughput scenarios. It supports a range of availability, persistence, and backup options.
</p>
<p>
Essentials plan
<a href="https://redis.io/pricing/#monthly">
pricing
</a>
scales according to the memory size of the database defined in the subscription. Additional limits also apply, as shown in the tables below.
</p>
<p>
The 30 MB Essentials plan is free; it's designed for learning and building test projects. It gives you enough space to learn Redis concepts and develop application prototypes.
</p>
<p>
Our paid plans start at 250 MB and offer extra features, like high availability and backups (both daily and instant). They are great for bigger projects or production environments that require increased storage, reliability, and other features to support your operational needs.
</p>
<p>
Essentials plans have bandwidth and throughput limits described in the tables below. We will notify you before limiting your database usage if you exceed these limits.
</p>
<p>
If you need additional resources, you can
<a href="/docs/latest/operate/rc/subscriptions/view-essentials-subscription/#upgrade-plan">
upgrade your subscription
</a>
at any time.
</p>
<h2 id="current-plans">
Current plans
</h2>
<p>
These plans are currently offered for all new and upgraded Essentials subscriptions (updated March 2024).
</p>
<div style="overflow-x: auto;">
<table>
<thead>
<tr>
<th>
<strong>
DB size
</strong>
<sup>
<a href="#table-note-1">
1
</a>
</sup>
</th>
<th>
<strong>
30 MB (Free)
</strong>
</th>
<th>
<strong>
250 MB
</strong>
</th>
<th>
<strong>
1 GB
</strong>
</th>
<th>
<strong>
2.5 GB
</strong>
</th>
<th>
<strong>
5 GB
</strong>
</th>
<th>
<strong>
12 GB
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Concurrent
<br/>
connections
<br/>
per database
</strong>
</td>
<td>
30
</td>
<td>
256
</td>
<td>
1024
</td>
<td>
2500
</td>
<td>
5000
</td>
<td>
10000
</td>
</tr>
<tr>
<td>
<strong>
CIDR
<br/>
allow rules
</strong>
</td>
<td>
1
</td>
<td>
4
</td>
<td>
4-8
</td>
<td>
4-8
</td>
<td>
4-16
</td>
<td>
4-32
</td>
</tr>
<tr>
<td>
<strong>
Monthly
<br/>
total network
<br/>
bandwidth
</strong>
</td>
<td>
5 GB
</td>
<td>
100 GB
</td>
<td>
200 GB
</td>
<td>
400 GB
</td>
<td>
800 GB
</td>
<td>
2000 GB
</td>
</tr>
<tr>
<td>
<strong>
Maximum
<br/>
throughput
<sup>
<a href="#table-note-2">
2
</a>
</sup>
</strong>
</td>
<td>
100 ops/sec
</td>
<td>
1000 ops/sec
</td>
<td>
2000 ops/sec
</td>
<td>
4000 ops/sec
</td>
<td>
8000 ops/sec
</td>
<td>
16000 ops/sec
</td>
</tr>
</tbody>
</table>
</div>
<ol>
<li>
<p>
<a name="table-note-1" style="display: block; height: 80px; margin-top: -80px;">
</a>
Database size includes replication where applicable. See
<a href="/docs/latest/operate/rc/databases/configuration/high-availability/#dataset-size">
High availability cost impact
</a>
for more information.
</p>
</li>
<li>
<p>
<a name="table-note-2" style="display: block; height: 80px; margin-top: -80px;">
</a>
Assumes request size of 1 KiB. Maximums are capped by actual MB/s reached. To find the MB/s limit, divide the Maximum throughput by 1024.
</p>
</li>
</ol>
<h2 id="legacy">
Previous plans
</h2>
<p>
These plans were available before November 2023.
</p>
<div style="overflow-x: auto;">
<table>
<thead>
<tr>
<th>
<strong>
Max DB size
</strong>
<sup>
<a href="#table-note-1-legacy">
1
</a>
</sup>
</th>
<th>
<strong>
30 MB
</strong>
</th>
<th>
<strong>
100 MB
</strong>
</th>
<th>
<strong>
250 MB
</strong>
</th>
<th>
<strong>
500 MB
</strong>
</th>
<th>
<strong>
1 GB
</strong>
</th>
<th>
<strong>
2.5 GB
</strong>
</th>
<th>
<strong>
5 GB
</strong>
</th>
<th>
<strong>
10 GB
</strong>
</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<strong>
Concurrent
<br/>
connections
<br/>
per database
</strong>
</td>
<td>
30
</td>
<td>
256
</td>
<td>
256
</td>
<td>
512
</td>
<td>
1024
</td>
<td>
2500
</td>
<td>
5000
</td>
<td>
10000
</td>
</tr>
<tr>
<td>
<strong>
Monthly
<br/>
total network
<br/>
bandwidth
</strong>
<sup>
<a href="#table-note-2-legacy">
2
</a>
</sup>
</td>
<td>
5 GB
</td>
<td>
50 GB
</td>
<td>
100 GB
</td>
<td>
150 GB
</td>
<td>
200 GB
</td>
<td>
400 GB
</td>
<td>
800 GB
</td>
<td>
2000 GB
</td>
</tr>
<tr>
<td>
<strong>
Maximum
<br/>
throughput
</strong>
</td>
<td>
100 ops/sec
</td>
<td>
500 ops/sec
</td>
<td>
1000 ops/sec
</td>
<td>
1500 ops/sec
</td>
<td>
2000 ops/sec
</td>
<td>
4000 ops/sec
</td>
<td>
8000 ops/sec
</td>
<td>
16000 ops/sec
</td>
</tr>
</tbody>
</table>
</div>
<ol>
<li>
<p>
<a name="table-note-1-legacy" style="display: block; height: 80px; margin-top: -80px;">
</a>
Database size includes replication. See
<a href="/docs/latest/operate/rc/databases/configuration/high-availability/#dataset-size">
High availability cost impact
</a>
for more information.
</p>
</li>
<li>
<p>
<a name="table-note-2-legacy" style="display: block; height: 80px; margin-top: -80px;">
</a>
Assumes request size of 1 KiB. Maximums are capped by actual MB/s reached. To find the MB/s limit, divide the Maximum throughput by 1024.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rc/subscriptions/view-essentials-subscription/essentials-plan-details/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/clusters/logging/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Logging events
</h1>
<p class="text-lg -mt-5 mb-10">
Management actions performed with Redis Enterprise are logged to make sure system management tasks are appropriately performed or monitored by administrators and for compliance with regulatory standards.
</p>
<p>
Management actions performed with Redis Enterprise are logged to make sure system management tasks are appropriately performed or monitored by administrators and for compliance with regulatory standards.
</p>
<p>
Log entries contain the
following information:
</p>
<ol>
<li>
Who performed the action?
</li>
<li>
What exactly was the performed action?
</li>
<li>
When was the action performed?
</li>
<li>
Did the action succeed or not?
</li>
</ol>
<p>
To get the list of logged events, you can use the REST API or
the
<strong>
Logs
</strong>
screen in the UI. The
<strong>
Logs
</strong>
screen displays the system and user
events regarding alerts, notifications, and configuration.
</p>
<a href="/docs/latest/images/rs/screenshots/cluster/cluster-logs.png" sdata-lightbox="/images/rs/screenshots/cluster/cluster-logs.png">
<img alt="Logs screen in the new Cluster Manager UI." src="/docs/latest/images/rs/screenshots/cluster/cluster-logs.png"/>
</a>
<p>
You can use the
<strong>
Logs
</strong>
screen to review what actions a user has performed, such as editing a database's configuration.
</p>
<ul>
<li>
<a href="/docs/latest/operate/rs/7.4/clusters/logging/redis-slow-log/">
Redis slow
log
</a>
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/clusters/logging/rsyslog-logging/">
rsyslog logging
</a>
</li>
</ul>
<h2 id="view-logs-in-the-ui">
View logs in the UI
</h2>
<p>
Redis Enterprise provides log files for auditing cluster management actions and troubleshooting. You can view these logs in the UI and on the host operating system.
</p>
<p>
To view event logs in the new Cluster Manager UI, go to
<strong>
Cluster > Logs
</strong>
.
</p>
<h2 id="view-logs-on-the-server">
View logs on the server
</h2>
<p>
Server logs can be found by default in the directory
<code>
/var/opt/redislabs/log/
</code>
.
</p>
<p>
These log files are used by the Redis support team to troubleshoot issues. The logs you will most frequently interact with is 'event_log.log'. This log file is where logs of configuration actions within Redis are stored and is useful to determine events that occur within Redis Enterprise.
</p>
<h2 id="configure-log-timestamps">
Configure log timestamps
</h2>
<p>
Redis Enterprise allows you to configure log timestamps. To configure log timestamps in the new Cluster Manager UI:
</p>
<ol>
<li>
<p>
Go to
<strong>
Cluster > Configuration > General
</strong>
.
</p>
</li>
<li>
<p>
Change the
<strong>
Time zone
</strong>
for the logs based on your location.
</p>
</li>
</ol>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/clusters/logging/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/rs/7.4/clusters/configure/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Configure clusters
</h1>
<p class="text-lg -mt-5 mb-10">
Configuration options for your Redis Enterprise cluster.
</p>
<p>
You can manage your Redis Enterprise Software clusters with several different tools:
</p>
<ul>
<li>
Cluster Manager UI (the web-based user interface)
</li>
<li>
Command-line tools (
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/rladmin/">
rladmin
</a>
,
<a href="/docs/latest/develop/tools/cli/">
redis-cli
</a>
,
<a href="/docs/latest/operate/rs/7.4/references/cli-utilities/crdb-cli/">
crdb-cli
</a>
)
</li>
<li>
<a href="/docs/latest/operate/rs/7.4/references/rest-api/">
REST API
</a>
</li>
</ul>
<nav>
<a href="/docs/latest/operate/rs/7.4/clusters/configure/cluster-settings/">
Cluster settings
</a>
<p>
You can view and set various cluster settings such as cluster name, email service, time zone, and license.
</p>
<a href="/docs/latest/operate/rs/7.4/clusters/configure/license-keys/">
Cluster license keys
</a>
<p>
The cluster key (or license) enables features and capacity within Redis Enterprise Software
</p>
<a href="/docs/latest/operate/rs/7.4/clusters/configure/sync-clocks/">
Synchronize cluster node clocks
</a>
<p>
Sync node clocks to avoid problems with internal custer communication.
</p>
<a href="/docs/latest/operate/rs/7.4/clusters/configure/rack-zone-awareness/">
Rack-zone awareness in Redis Enterprise Software
</a>
<p>
Rack-zone awareness ensures high availability in the event of a rack or zone failure.
</p>
</nav>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/rs/7.4/clusters/configure/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/touch/.html | <section class="prose w-full py-12">
<h1 class="command-name">
TOUCH
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">TOUCH key [key ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
3.2.1
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the number of keys that will be touched.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@keyspace
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Alters the last access time of a key(s).
A key is ignored if it does not exist.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SET key1 "Hello"
"OK"
redis> SET key2 "World"
"OK"
redis> TOUCH key1 key2
(integer) 2
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#integers">
Integer reply
</a>
: the number of touched keys.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/touch/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/active-active/prepare-clusters/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Prepare participating clusters
</h1>
<p class="text-lg -mt-5 mb-10">
Prepare your participating RECs to be part of an Active-Active database deployment.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
This feature is supported for general availability in releases 6.4.2-6 and later. Some of these features were available as a preview in 6.4.2-4 and 6.4.2-5. Please upgrade to 6.4.2-6 for the full set of general availability features and bug fixes.
</div>
</div>
<h2 id="prepare-participating-clusters">
Prepare participating clusters
</h2>
<p>
Before you prepare your clusters to participate in an Active-Active database, make sure you've completed all the following steps and have gathered the information listed below each step.
</p>
<ol>
<li>
<p>
Configure the
<a href="/docs/latest/operate/kubernetes/deployment/quick-start/#enable-the-admission-controller/">
admission controller and ValidatingWebhook
</a>
.
</p>
</li>
<li>
<p>
Create two or more
<a href="/docs/latest/operate/kubernetes/deployment/quick-start/#create-a-redis-enterprise-cluster-rec">
RedisEnterpriseCluster (REC) custom resources
</a>
with enough
<a href="/docs/latest/operate/rs/installing-upgrading/install/plan-deployment/hardware-requirements/">
memory resources
</a>
.
</p>
<ul>
<li>
Name of each REC (
<code>
<rec-name>
</code>
)
</li>
<li>
Namespace for each REC (
<code>
<rec-namespace>
</code>
)
</li>
</ul>
</li>
<li>
<p>
Configure the REC
<a href="/docs/latest/operate/kubernetes/networking/ingressorroutespec/">
<code>
ingressOrRoutes
</code>
field
</a>
and
<a href="/docs/latest/operate/kubernetes/networking/ingressorroutespec/#configure-dns/">
create DNS records
</a>
.
</p>
<ul>
<li>
REC API hostname (
<code>
api-<rec-name>-<rec-namespace>.<subdomain>
</code>
)
</li>
<li>
Database hostname suffix (
<code>
-db-<rec-name>-<rec-namespace>.<subdomain>
</code>
)
</li>
</ul>
</li>
</ol>
<p>
Next you'll
<a href="#collect-rec-credentials">
collect credentials
</a>
for your participating clusters and create secrets for the RedisEnterprsieRemoteCluster (RERC) to use.
</p>
<p>
For a list of example values used throughout this article, see the
<a href="#example-values">
Example values
</a>
section.
</p>
<h3 id="preview-versions">
Preview versions
</h3>
<p>
If you are using a preview version of these features (operator version 6.4.2-4 or 6.4.2-5), you'll need to enable the Active-Active controller with the following steps. You need to do this only once per cluster. We recommend using the fully supported 6.4.2-6 version.
</p>
<ol>
<li>
<p>
Download the custom resource definitions (CRDs) for the most recent release (6.4.2-4) from
<a href="https://github.com/RedisLabs/redis-enterprise-k8s-docs/tree/master/crds">
redis-enterprise-k8s-docs Github
</a>
.
</p>
</li>
<li>
<p>
Apply the new CRDs for the Redis Enterprise Active-Active database (REAADB) and Redis Enterprise remote cluster (RERC) to install those controllers.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f crds/reaadb_crd.yaml
</span></span><span class="line"><span class="cl">kubectl apply -f crds/rerc_crd.yaml
</span></span></code></pre>
</div>
</li>
<li>
<p>
Enable the Active-Active and remote cluster controllers on the operator ConfigMap.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl patch cm operator-environment-config --type merge --patch <span class="s2">"{\"data\": \
</span></span></span><span class="line"><span class="cl"><span class="s2">{\"ACTIVE_ACTIVE_DATABASE_CONTROLLER_ENABLED\":\"true\", \
</span></span></span><span class="line"><span class="cl"><span class="s2">\"REMOTE_CLUSTER_CONTROLLER_ENABLED\":\"true\"}}"</span>
</span></span></code></pre>
</div>
</li>
</ol>
<h2 id="collect-rec-credentials">
Collect REC credentials
</h2>
<p>
To communicate with other clusters, all participating clusters will need access to the admin credentials for all other clusters.
</p>
<ol>
<li>
<p>
Create a file to hold the admin credentials for all participating RECs (such as
<code>
all-rec-secrets.yaml
</code>
).
</p>
</li>
<li>
<p>
Within that file, create a new secret for each participating cluster named
<code>
redis-enterprise-<rerc-name>
</code>
.
</p>
<p>
The example below shows a file (
<code>
all-rec-secrets.yaml
</code>
) holding secrets for two participating clusters:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-rerc-ohare</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">Opaque</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nn">---</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-rerc-reagan</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">Opaque</span><span class="w">
</span></span></span></code></pre>
</div>
</li>
<li>
<p>
Get the REC credentials secret for each participating cluster.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get secret -o yaml <rec-name>
</span></span></code></pre>
</div>
<p>
The admin credentials secret for an REC named
<code>
rec-chicago
</code>
would be similar to this:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">ABcdef12345</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l">GHij56789</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">rec-chicago</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">Opaque</span><span class="w">
</span></span></span></code></pre>
</div>
</li>
<li>
<p>
Add the username and password to the new secret for that REC and namespace.
</p>
<p>
This example shows the collected secrets file (
<code>
all-rec-secrets.yaml
</code>
) for
<code>
rerc-ohare
</code>
(representing
<code>
rec-chicago
</code>
in namespace
<code>
ns-illinois
</code>
) and
<code>
rerc-reagan
</code>
(representing
<code>
rec-arlington
</code>
in namespace
<code>
ns-virginia
</code>
).
</p>
<div class="highlight">
<pre class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">ABcdef12345</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l">GHij56789</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-rerc-ohare</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">Opaque</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nn">---</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">data</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l">KLmndo123456</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l">PQrst789010</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Secret</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-rerc-reagan</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">type</span><span class="p">:</span><span class="w"> </span><span class="l">Opaque</span><span class="w">
</span></span></span></code></pre>
</div>
</li>
<li>
<p>
Apply the file of collected secrets to every participating REC.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl apply -f <all-rec-secrets-file>
</span></span></code></pre>
</div>
<p>
If the admin credentials for any of the clusters changes, the file will need to be updated and reapplied to all clusters.
</p>
</li>
</ol>
<h2 id="next-steps">
Next steps
</h2>
<p>
Now you are ready to
<a href="/docs/latest/operate/kubernetes/active-active/create-reaadb/">
create your Redis Enterprise Active-Active database
</a>
.
</p>
<h2 id="example-values">
Example values
</h2>
<p>
This article uses the following example values:
</p>
<h4 id="example-cluster-1">
Example cluster 1
</h4>
<ul>
<li>
REC name:
<code>
rec-chicago
</code>
</li>
<li>
REC namespace:
<code>
ns-illinois
</code>
</li>
<li>
RERC name:
<code>
rerc-ohare
</code>
</li>
<li>
RERC secret name:
<code>
redis-enterprise-rerc-ohare
</code>
</li>
<li>
API FQDN:
<code>
api-rec-chicago-ns-illinois.example.com
</code>
</li>
<li>
DB FQDN suffix:
<code>
-db-rec-chicago-ns-illinois.example.com
</code>
</li>
</ul>
<h4 id="example-cluster-2">
Example cluster 2
</h4>
<ul>
<li>
REC name:
<code>
rec-arlington
</code>
</li>
<li>
REC namespace:
<code>
ns-virginia
</code>
</li>
<li>
RERC name:
<code>
rerc-raegan
</code>
</li>
<li>
RERC secret name:
<code>
redis-enterprise-rerc-reagan
</code>
</li>
<li>
API FQDN:
<code>
api-rec-arlington-ns-virginia.example.com
</code>
</li>
<li>
DB FQDN suffix:
<code>
-db-rec-arlington-ns-virginia.example.com
</code>
</li>
</ul>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/active-active/prepare-clusters/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/deployment/container-images/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Use a private registry for container images
</h1>
<p class="text-lg -mt-5 mb-10">
This section details how the Redis Enterprise Software and Kubernetes operator images can be configured to be pulled from a variety of sources. This page describes how to configure alternate private repositories for images, plus some techniques for handling public repositories with rate limiting.
</p>
<p>
Redis Enterprise Software, its Kubernetes operator, and the Service Rigger
are all distributed as separate container images.
Your Kubernetes deployment will pull these images as needed.
You can control where these images are
pulled from within the operator deployment and also via the
Redis Enterprise custom resources.
</p>
<p>
In general, images for deployments that do not have a registry domain
name (e.g.,
<code>
gcr.io
</code>
or
<code>
localhost:5000
</code>
) are pulled from the default registry associated
with the Kubernetes cluster. A plain reference to
<code>
redislabs/redis
</code>
will likely pull from DockerHub
(except on OpenShift where it pulls from Red Hat).
</p>
<p>
For security reasons (e.g., in air-gapped environments), you may want to pull the images
from a public registry once and then push them to a private registry under
your control.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Warning:
</div>
It is very important that the images you are pushing to the private registry have the same exact version tag as the original images.
</div>
</div>
<p>
Furthermore, because
<a href="https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/">
Docker rate limits public pulls
</a>
,
you may want to consider pulling images from a
private registry to avoid deployment failures when you hit your DockerHub rate limit.
</p>
<p>
The information below will help you track and configure where your deployments pull container images.
</p>
<div class="alert p-3 relative flex flex-row items-center text-base bg-redis-pencil-200 rounded-md">
<div class="p-2 pr-5">
<svg fill="none" height="21" viewbox="0 0 21 21" width="21" xmlns="http://www.w3.org/2000/svg">
<circle cx="10.5" cy="10.5" r="9.75" stroke="currentColor" stroke-width="1.5">
</circle>
<path d="M10.5 14V16" stroke="currentColor" stroke-width="2">
</path>
<path d="M10.5 5V12" stroke="currentColor" stroke-width="2">
</path>
</svg>
</div>
<div class="p-1 pl-6 border-l border-l-redis-ink-900 border-opacity-50">
<div class="font-medium">
Note:
</div>
<p>
<strong>
IMPORTANT
</strong>
</p>
<ul>
<li>
Each version of the Redis Enterprise operator is mapped to a specific version of Redis Enterprise Software. The semantic versions always match (for example, 7.2.4), although the specific release numbers may be different (for example, 7.2.4-7 is the operator version for Redis Enterprise Software 7.2.4-64).
</li>
<li>
A specific operator version only supports a specific Redis Enterprise version. Other combinations of operator and Redis Enterprise versions are
<strong>
not supported
</strong>
.
</li>
</ul>
</div>
</div>
<h2 id="find-container-sources">
Find container sources
</h2>
<p>
Every pod in your deployed application has a source registry. Any image not prefixed by a registry domain name (e.g., "gcr.io") will pull from the default registry for the Kubernetes cluster (i.e., DockerHub). You can use the commands below to discover the pull sources for the images on your cluster.
</p>
<p>
To list all the images used by your cluster:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get pods --all-namespaces -o <span class="nv">jsonpath</span><span class="o">=</span><span class="s2">"{..image}"</span> <span class="p">|</span>tr -s <span class="s1">'[[:space:]]'</span> <span class="s1">'\n'</span> <span class="p">|</span> uniq -c
</span></span></code></pre>
</div>
<p>
To specifically determine the pull source for the Redis Enterprise operator itself, run the following command:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">kubectl get pods --all-namespaces -o <span class="nv">jsonpath</span><span class="o">=</span><span class="s2">"{..image}"</span> <span class="p">|</span>tr -s <span class="s1">'[[:space:]]'</span> <span class="s1">'\n'</span> <span class="p">|</span> uniq -c <span class="p">|</span> grep redislabs
</span></span></code></pre>
</div>
<p>
You can limit this command to specific namespaces by replacing the
<code>
--all-namespaces
</code>
parameter with
a set of
<code>
-n {namespace}
</code>
parameters, where each
<code>
{namespace}
</code>
is a specific
namespace of interest on your cluster.
</p>
<h2 id="create-a-private-container-registry">
Create a private container registry
</h2>
<p>
You can set up a private container registry in a couple of ways:
</p>
<ul>
<li>
On-premise via
<a href="https://docs.docker.com/registry/deploying/">
Docker registry
</a>
,
<a href="https://www.redhat.com/en/technologies/cloud-computing/quay">
Red Hat Quay
</a>
, or other providers
</li>
<li>
Cloud provider based registries (e.g., Azure Container Registry, Google Container Registry, etc.).
</li>
</ul>
<p>
Once you have set up a private container registry, you will identify the container registry using:
</p>
<ul>
<li>
A domain name
</li>
<li>
A port (optional)
</li>
<li>
A repository path (optional)
</li>
</ul>
<h2 id="push-images-to-a-private-container-registry">
Push images to a private container registry
</h2>
<p>
Important images for a Redis Enterprise Software deployment include:
</p>
<ul>
<li>
Redis Enterprise Software
</li>
<li>
Bootstrapping a Redis Enterprise cluster node (in the operator image)
</li>
<li>
The Service Rigger
</li>
<li>
The Redis Enterprise Software operator
</li>
</ul>
<p>
You will need to push all these images to your private container registry. In general,
to push the images you must:
</p>
<ol>
<li>
<a href="https://docs.docker.com/engine/reference/commandline/pull/">
Pull
</a>
the various images locally for the Redis Enterprise Software, the Service Rigger, and the operator.
</li>
<li>
Tag the local images with the private container registry, repository, and version tag.
</li>
<li>
<a href="https://docs.docker.com/engine/reference/commandline/push/">
Push
</a>
the newly tagged images.
</li>
</ol>
<p>
The example below shows the commands for pushing the images for Redis Enterprise Software and its operator to a private container registry:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="nv">PRIVATE_REPO</span><span class="o">=</span>...your repo...
</span></span><span class="line"><span class="cl"><span class="nv">RS_VERSION</span><span class="o">=</span>7.2.4-64
</span></span><span class="line"><span class="cl"><span class="nv">OPERATOR_VERSION</span><span class="o">=</span>7.2.4-7
</span></span><span class="line"><span class="cl">docker pull redislabs/redis:<span class="si">${</span><span class="nv">RS_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker pull redislabs/operator:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker pull redislabs/k8s-controller:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker tag redislabs/redis:<span class="si">${</span><span class="nv">RS_VERSION</span><span class="si">}</span> <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/redis:<span class="si">${</span><span class="nv">RS_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker tag redislabs/operator:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span> <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/operator:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker tag redislabs/k8s-controller:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span> <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/k8s-controller:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker push <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/redis:<span class="si">${</span><span class="nv">RS_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker push <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/operator:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span><span class="line"><span class="cl">docker push <span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/k8s-controller:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span></code></pre>
</div>
<h2 id="configure-deployments-to-use-a-private-container-registry">
Configure deployments to use a private container registry
</h2>
<p>
Once you push your images to your private container registry, you need to
configure your deployments to use that registry for Redis Enterprise Software and operator
deployments. The operator container image is configured directly by the operator deployment
bundle. The Redis Enterprise cluster pod (RS and bootstrapper) and Service Rigger
images are configured in the Redis Enterprise custom resource.
</p>
<p>
Depending on your Kubernetes platform, your private container registry may
require authentication. If you do need authentication, add a
<a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/">
pull secret
</a>
to your namespace. Then you'll need to configure Kubernetes and the operator to use the pull secret. The two following sections have examples of adding the
<code>
imagePullSecrets
</code>
to the operator deployment and
<code>
pullSecrets
</code>
to the cluster custom resource.
</p>
<h3 id="specify-the-operator-image-source">
Specify the operator image source
</h3>
<p>
The operator bundle contains the operator deployment and the reference to the operator image (
<code>
redislabs/operator
</code>
). To use a private container registry, you must
change this image reference in your operator deployment file
<strong>
before
</strong>
you deploy the operator. If you apply this change to modify an existing operator deployment, the operator's pod will restart.
</p>
<p>
In the operator deployment file, 'containers:image' should point to the same repository and tag you used when
<a href="/docs/latest/operate/kubernetes/deployment/container-images/#push-images-to-a-private-container-registry">
pushing
</a>
to the private container registry:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl"><span class="si">${</span><span class="nv">PRIVATE_REPO</span><span class="si">}</span>/redislabs/operator:<span class="si">${</span><span class="nv">OPERATOR_VERSION</span><span class="si">}</span>
</span></span></code></pre>
</div>
<p>
The example below specifies a 7.2.4-7 operator image in a Google Container Registry:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-YAML" data-lang="YAML"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">apps/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">Deployment</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">replicas</span><span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">selector</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">matchLabels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">template</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">serviceAccountName</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">containers</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">redis-enterprise-operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/operator:7.2.4-7</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nn">...</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
If your container registry requires a pull secret, configure
<code>
imagePullSecrets
</code>
on the operator deployment:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-YAML" data-lang="YAML"><span class="line"><span class="cl"><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">template</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullSecrets</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">regcred</span><span class="w">
</span></span></span></code></pre>
</div>
<h3 id="specify-the-redis-enterprise-cluster-images-source">
Specify the Redis Enterprise cluster images source
</h3>
<p>
A Redis Enterprise cluster managed by the operator consists of three
container images:
</p>
<ul>
<li>
<strong>
<code>
redislabs/redis
</code>
</strong>
: the Redis Enterprise Software container image
</li>
<li>
<strong>
<code>
redislabs/operator
</code>
</strong>
: the bootstrapper is packaged within the operator container image
</li>
<li>
<strong>
<code>
redislabs/k8s-controller
</code>
</strong>
: the Service Rigger container image
</li>
</ul>
<p>
By default, a new Redis Enterprise cluster is created using the
container images listed above. These container images are pulled from the K8s cluster's default
container registry.
</p>
<p>
To
<a href="https://docs.docker.com/engine/reference/commandline/pull/">
pull
</a>
the Redis Enterprise container images from
a private container registry, you must specify them in the
Redis Enterprise cluster custom resource.
</p>
<p>
Add the following sections to the
<code>
spec
</code>
section of your RedisEnterpriseCluster resource file:
</p>
<ul>
<li>
<strong>
<code>
redisEnterpriseImageSpec
</code>
</strong>
: controls the Redis Enterprise Software container image.
<em>
The version should match the RS version associated with the operator version
</em>
.
</li>
<li>
<strong>
<code>
bootstrapperImageSpec
</code>
</strong>
": controls the bootstrapper container image.
<em>
The version must match the operator version
</em>
.
</li>
<li>
<strong>
<code>
redisEnterpriseServicesRiggerImageSpec
</code>
</strong>
: controls the Service Rigger container image.
<em>
The version must match the operator version
</em>
.
</li>
</ul>
<p>
The REC custom resource example below pulls all three container images from a GCR private registry:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-YAML" data-lang="YAML"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">app.redislabs.com/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">RedisEnterpriseCluster</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">rec</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">nodes</span><span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redisEnterpriseImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/redis</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-64</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">bootstrapperImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-7</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redisEnterpriseServicesRiggerImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/k8s-controller</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-7</span><span class="w">
</span></span></span></code></pre>
</div>
<p>
If your private container registry requires pull secrets, you must add
<code>
pullSecrets
</code>
to the
<code>
spec
</code>
section:
</p>
<div class="highlight">
<pre class="chroma"><code class="language-YAML" data-lang="YAML"><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">app.redislabs.com/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">RedisEnterpriseCluster</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">rec</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"></span><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">nodes</span><span class="p">:</span><span class="w"> </span><span class="m">3</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">pullSecrets</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span>- <span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">regcred</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redisEnterpriseImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/redis</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-64</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">bootstrapperImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/operator</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-7</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">redisEnterpriseServicesRiggerImageSpec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">imagePullPolicy</span><span class="p">:</span><span class="w"> </span><span class="l">IfNotPresent</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">repository</span><span class="p">:</span><span class="w"> </span><span class="l">gcr.io/yourproject/redislabs/k8s-controller</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">versionTag</span><span class="p">:</span><span class="w"> </span><span class="m">7.2.4-7</span><span class="w">
</span></span></span></code></pre>
</div>
<h2 id="rate-limiting-with-dockerhub">
Rate limiting with DockerHub
</h2>
<p>
Docker has
<a href="https://www.docker.com/blog/scaling-docker-to-serve-millions-more-developers-network-egress/">
rate limits for image pulls
</a>
.
Anonymous users are allowed a certain number of pulls every 6 hours. For authenticated users, the limit is larger.
These rate limits may affect your Kubernetes cluster in a number of ways:
</p>
<ul>
<li>
The cluster nodes will likely be treated as a single anonymous user.
</li>
<li>
The number of pulls during a deployment might exceed the rate limit for other deployment dependencies, including the operator, Redis Enterprise Software, or other non-Redis pods.
</li>
<li>
Pull failures may prevent your deployment from downloading the required images in a timely manner. Delays here can affect the stability of deployments used by the Redis Enterprise operator.
</li>
</ul>
<p>
For these reasons, you should seriously consider where your images
are pulled from to
<strong>
avoid failures caused by rate limiting
</strong>
. The easiest solution
is to push the required images to a private container registry under your control.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/deployment/container-images/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di-configure/.html | <section class="prose w-full py-12 max-w-none">
<h1>
redis-di configure
</h1>
<p class="text-lg -mt-5 mb-10">
Configures the Write-behind Database so it is ready to process data
</p>
<h2 id="usage">
Usage
</h2>
<pre tabindex="0"><code>Usage: redis-di configure [OPTIONS]
</code></pre>
<h2 id="options">
Options
</h2>
<ul>
<li>
<p>
<code>
loglevel
</code>
:
</p>
<ul>
<li>
Type: Choice(['DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'])
</li>
<li>
Default:
<code>
info
</code>
</li>
<li>
Usage:
<code>
--loglevel -log-level
</code>
</li>
</ul>
</li>
<li>
<p>
<code>
rdi_host
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-host
</code>
</li>
</ul>
<p>
Host/IP of Write-behind Database
</p>
</li>
<li>
<p>
<code>
rdi_port
</code>
(REQUIRED):
</p>
<ul>
<li>
Type: <IntRange 1000<=x<=65535>
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-port
</code>
</li>
</ul>
<p>
Port of Write-behind Database
</p>
</li>
<li>
<p>
<code>
rdi_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-password
</code>
</li>
</ul>
<p>
Write-behind Database Password
</p>
</li>
<li>
<p>
<code>
rdi_key
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key
</code>
</li>
</ul>
<p>
Private key file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cert
</code>
</li>
</ul>
<p>
Client certificate file to authenticate with
</p>
</li>
<li>
<p>
<code>
rdi_cacert
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-cacert
</code>
</li>
</ul>
<p>
CA certificate file to verify with
</p>
</li>
<li>
<p>
<code>
rdi_key_password
</code>
:
</p>
<ul>
<li>
Type: STRING
</li>
<li>
Default:
<code>
none
</code>
</li>
<li>
Usage:
<code>
--rdi-key-password
</code>
</li>
</ul>
<p>
Password for unlocking an encrypted private key
</p>
</li>
<li>
<p>
<code>
help
</code>
:
</p>
<ul>
<li>
Type: BOOL
</li>
<li>
Default:
<code>
false
</code>
</li>
<li>
Usage:
<code>
--help
</code>
</li>
</ul>
<p>
Show this message and exit.
</p>
</li>
</ul>
<h2 id="cli-help">
CLI help
</h2>
<pre tabindex="0"><code>Usage: redis-di configure [OPTIONS]
Configures the Write-behind Database so it is ready to process data
Options:
-log-level, --loglevel [DEBUG|INFO|WARN|ERROR|CRITICAL]
[default: INFO]
--rdi-host TEXT Host/IP of Write-behind Database [required]
--rdi-port INTEGER RANGE Port of Write-behind Database [1000<=x<=65535;
required]
--rdi-password TEXT Write-behind Database Password
--rdi-key TEXT Private key file to authenticate with
--rdi-cert TEXT Client certificate file to authenticate with
--rdi-cacert TEXT CA certificate file to verify with
--rdi-key-password TEXT Password for unlocking an encrypted private
key
--help Show this message and exit.
</code></pre>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/integrate/write-behind/reference/cli/redis-di-configure/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/role/.html | <section class="prose w-full py-12">
<h1 class="command-name">
ROLE
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">ROLE</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
2.8.12
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(1)
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@admin
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@fast
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@dangerous
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Provide information on the role of a Redis instance in the context of replication, by returning if the instance is currently a
<code>
master
</code>
,
<code>
slave
</code>
, or
<code>
sentinel
</code>
. The command also returns additional information about the state of the replication (if the role is master or slave) or the list of monitored master names (if the role is sentinel).
</p>
<h2 id="output-format">
Output format
</h2>
<p>
The command returns an array of elements. The first element is the role of
the instance, as one of the following three strings:
</p>
<ul>
<li>
"master"
</li>
<li>
"slave"
</li>
<li>
"sentinel"
</li>
</ul>
<p>
The additional elements of the array depends on the role.
</p>
<h2 id="master-output">
Master output
</h2>
<p>
An example of output when
<code>
ROLE
</code>
is called in a master instance:
</p>
<pre tabindex="0"><code>1) "master"
2) (integer) 3129659
3) 1) 1) "127.0.0.1"
2) "9001"
3) "3129242"
2) 1) "127.0.0.1"
2) "9002"
3) "3129543"
</code></pre>
<p>
The master output is composed of the following parts:
</p>
<ol>
<li>
The string
<code>
master
</code>
.
</li>
<li>
The current master replication offset, which is an offset that masters and replicas share to understand, in partial resynchronizations, the part of the replication stream the replicas needs to fetch to continue.
</li>
<li>
An array composed of three elements array representing the connected replicas. Every sub-array contains the replica IP, port, and the last acknowledged replication offset.
</li>
</ol>
<h2 id="output-of-the-command-on-replicas">
Output of the command on replicas
</h2>
<p>
An example of output when
<code>
ROLE
</code>
is called in a replica instance:
</p>
<pre tabindex="0"><code>1) "slave"
2) "127.0.0.1"
3) (integer) 9000
4) "connected"
5) (integer) 3167038
</code></pre>
<p>
The replica output is composed of the following parts:
</p>
<ol>
<li>
The string
<code>
slave
</code>
, because of backward compatibility (see note at the end of this page).
</li>
<li>
The IP of the master.
</li>
<li>
The port number of the master.
</li>
<li>
The state of the replication from the point of view of the master, that can be
<code>
connect
</code>
(the instance needs to connect to its master),
<code>
connecting
</code>
(the master-replica connection is in progress),
<code>
sync
</code>
(the master and replica are trying to perform the synchronization),
<code>
connected
</code>
(the replica is online).
</li>
<li>
The amount of data received from the replica so far in terms of master replication offset.
</li>
</ol>
<h2 id="sentinel-output">
Sentinel output
</h2>
<p>
An example of Sentinel output:
</p>
<pre tabindex="0"><code>1) "sentinel"
2) 1) "resque-master"
2) "html-fragments-master"
3) "stats-master"
4) "metadata-master"
</code></pre>
<p>
The sentinel output is composed of the following parts:
</p>
<ol>
<li>
The string
<code>
sentinel
</code>
.
</li>
<li>
An array of master names monitored by this Sentinel instance.
</li>
</ol>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> ROLE
1) "master"
2) (integer) 0
3) (empty array)
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<p>
<strong>
A note about the word slave used in this man page
</strong>
: Starting with Redis 5, if not for backward compatibility, the Redis project no longer uses the word slave. Unfortunately in this command the word slave is part of the protocol, so we'll be able to remove such occurrences only when this API will be naturally deprecated.
</p>
<h2 id="resp2resp3-reply">
RESP2/RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: where the first element is one of
<code>
master
</code>
,
<code>
slave
</code>
, or
<code>
sentinel
</code>
, and the additional elements are role-specific as illustrated above.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/role/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/commands/sdiff/.html | <section class="prose w-full py-12">
<h1 class="command-name">
SDIFF
</h1>
<div class="font-semibold text-redis-ink-900">
Syntax
</div>
<pre class="command-syntax">SDIFF key [key ...]</pre>
<dl class="grid grid-cols-[auto,1fr] gap-2 mb-12">
<dt class="font-semibold text-redis-ink-900 m-0">
Available since:
</dt>
<dd class="m-0">
1.0.0
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
Time complexity:
</dt>
<dd class="m-0">
O(N) where N is the total number of elements in all given sets.
</dd>
<dt class="font-semibold text-redis-ink-900 m-0">
ACL categories:
</dt>
<dd class="m-0">
<code>
@read
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@set
</code>
<span class="mr-1 last:hidden">
,
</span>
<code>
@slow
</code>
<span class="mr-1 last:hidden">
,
</span>
</dd>
</dl>
<p>
Returns the members of the set resulting from the difference between the first
set and all the successive sets.
</p>
<p>
For example:
</p>
<pre tabindex="0"><code>key1 = {a,b,c,d}
key2 = {c}
key3 = {a,c,e}
SDIFF key1 key2 key3 = {b,d}
</code></pre>
<p>
Keys that do not exist are considered to be empty sets.
</p>
<h2 id="examples">
Examples
</h2>
<div class="bg-slate-900 border-b border-slate-700 rounded-t-xl px-4 py-3 w-full flex">
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L18.6603 17.5L1.33975 17.5L10 2.5Z">
</path>
</svg>
<svg class="shrink-0 h-[1.0625rem] w-[1.0625rem] fill-slate-50" fill="currentColor" viewbox="0 0 20 20">
<path d="M10 2.5L12.0776 7.9322L17.886 8.22949L13.3617 11.8841L14.8738 17.5L10 14.3264L5.1262 17.5L6.63834 11.8841L2.11403 8.22949L7.92238 7.9322L10 2.5Z">
</path>
</svg>
</div>
<form class="redis-cli overflow-y-auto max-h-80">
<pre tabindex="0">redis> SADD key1 "a"
(integer) 1
redis> SADD key1 "b"
(integer) 1
redis> SADD key1 "c"
(integer) 1
redis> SADD key2 "c"
(integer) 1
redis> SADD key2 "d"
(integer) 1
redis> SADD key2 "e"
(integer) 1
redis> SDIFF key1 key2
1) "a"
2) "b"
</pre>
<div class="prompt" style="">
<span>
redis>
</span>
<input autocomplete="off" name="prompt" spellcheck="false" type="text"/>
</div>
</form>
<h2 id="resp2-reply">
RESP2 Reply
</h2>
<a href="../../develop/reference/protocol-spec#arrays">
Array reply
</a>
: a list with members of the resulting set.
<h2 id="resp3-reply">
RESP3 Reply
</h2>
<a href="../../develop/reference/protocol-spec#sets">
Set reply
</a>
: a set with the members of the resulting set.
<br/>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/commands/sdiff/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|
https://redis.io/docs/latest/operate/kubernetes/upgrade/upgrade-olm/.html | <section class="prose w-full py-12 max-w-none">
<h1>
Upgrade Redis Enterprise with OpenShift OperatorHub
</h1>
<p class="text-lg -mt-5 mb-10">
This task describes how to upgrade a Redis Enterprise cluster via OpenShift OperatorHub.
</p>
<h2 id="before-upgrading">
Before upgrading
</h2>
<ol>
<li>
<p>
Check
<a href="/docs/latest/operate/kubernetes/reference/supported_k8s_distributions/">
Supported Kubernetes distributions
</a>
to make sure your Kubernetes distribution is supported.
</p>
</li>
<li>
<p>
Use
<code>
oc get rec
</code>
and verify the
<code>
LICENSE STATE
</code>
is valid on your REC before you start the upgrade process.
</p>
</li>
<li>
<p>
Verify you are upgrading from Redis Enterprise operator version 6.2.10-45 or later. If you are not, you must upgrade to 6.2.10-45 before upgrading to versions 6.2.18 or later.
</p>
</li>
</ol>
<h2 id="upgrade-the-redis-enterprise-operator">
Upgrade the Redis Enterprise operator
</h2>
<ol>
<li>
<p>
Select the
<strong>
Redis Enterprise Operator
</strong>
from the
<strong>
Operators
</strong>
>
<strong>
Installed Operators
</strong>
page.
</p>
</li>
<li>
<p>
Select the
<strong>
Subscription
</strong>
tab.
</p>
</li>
<li>
<p>
Verify your
<strong>
Update approval
</strong>
is set to "Manual".
</p>
</li>
<li>
<p>
If you wish to upgrade to the most recent version, set your
<strong>
Update channel
</strong>
to "production". If you wish to upgrade to an older version, select it for your Update channel.
</p>
</li>
<li>
<p>
Select
<strong>
Upgrade available
</strong>
shown under
<strong>
Upgrade status
</strong>
.
</p>
</li>
<li>
<p>
When the "Review manual InstallPlan" section appears, select
<strong>
Preview installPlan
</strong>
and then
<strong>
Approve
</strong>
after reviewing the details. This will start the operator upgrade.
</p>
</li>
</ol>
<p>
You can monitor the upgrade from the
<strong>
Installed Operators
</strong>
page. A new Redis Enterprise Operator will appear in the list, with the status "Installing". The OpenShift will delete the old operator, showing the "Cannot update" status during deletion.
</p>
<h2 id="reapply-the-scc">
Reapply the SCC
</h2>
<p>
If you are using OpenShift, you will also need to manually reapply the
<a href="https://docs.openshift.com/container-platform/4.8/authentication/managing-security-context-constraints.html">
security context constraints
</a>
file (
<a href="/docs/latest/operate/kubernetes/deployment/openshift/openshift-cli/#deploy-the-operator">
<code>
scc.yaml
</code>
</a>
) and bind it to your service account.
</p>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">oc apply -f openshift/scc.yaml
</span></span></code></pre>
</div>
<div class="highlight">
<pre class="chroma"><code class="language-sh" data-lang="sh"><span class="line"><span class="cl">oc adm policy add-scc-to-user redis-enterprise-scc-v2 <span class="se">\
</span></span></span><span class="line"><span class="cl"><span class="se"></span> system:serviceaccount:<my-project>:<rec-name>
</span></span></code></pre>
</div>
<p>
If you are upgrading from operator version 6.4.2-6 or before, see the
<a href="/docs/latest/operate/kubernetes/upgrade/openshift-cli/#after-upgrading">
after upgrading section in the OpenShift CLI upgrade
</a>
to delete the old SCC and role binding after all clusters are running 6.4.2-6 or later.
</p>
<form class="text-sm w-full mt-24 pt-5 border-t border-t-redis-pen-700 border-opacity-50" id="page-feedback" name="page-feedback">
<input class="hidden" name="origin" value="https://redis.io/docs/latest/operate/kubernetes/upgrade/upgrade-olm/"/>
<div class="flex flex-row justify-between">
<div class="grid justify-center">
<span class="font-mono">
RATE THIS PAGE
</span>
<div class="star-rating">
<input id="5-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="5"/>
<label class="star" for="5-stars">
★
</label>
<input id="4-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="4"/>
<label class="star" for="4-stars">
★
</label>
<input id="3-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="3"/>
<label class="star" for="3-stars">
★
</label>
<input id="2-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="2"/>
<label class="star" for="2-stars">
★
</label>
<input id="1-stars" name="rating" onchange="document.querySelector('#feedback-form').classList.remove('hidden')" type="radio" value="1"/>
<label class="star" for="1-stars">
★
</label>
</div>
</div>
<a class="font-mono no-underline" href="#">
Back to top ↑
</a>
</div>
<div class="hidden" id="feedback-form">
<div class="grid gap-2">
<textarea class="p-2 mt-1 block w-full h-24 border border-opacity-50 border-redis-ink-900 rounded-md" name="comment" placeholder="Why did you choose this rating?" rows="3"></textarea>
<button class="font-mono button text-redis-ink-900 border border-solid border-transparent bg-redis-red-500 hover:bg-redis-red-600 focus:bg-red-600 focus:ring-red-600; w-min justify-self-end" type="submit">
Submit
</button>
</div>
</div>
</form>
<script>
document.addEventListener("DOMContentLoaded", function() {
const form = document.querySelector("#page-feedback");
form.addEventListener("submit", function(event) {
event.preventDefault();
var xhr = new XMLHttpRequest();
var url = "\/docusight\/api\/rate";
var params = new URLSearchParams(new FormData(form));
xhr.open("POST", url, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
const responseData = JSON.parse(xhr.responseText);
const responseMessage = responseData.response;
const newText = document.createTextNode(responseMessage);
form.parentNode.replaceChild(newText, form);
}
};
xhr.send(params);
});
});
</script>
</section>
|