(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[540],{8341:function(e,n,s){(window.__NEXT_P=window.__NEXT_P||[]).push(["/filter",function(){return s(5182)}])},5182:function(e,n,s){"use strict";s.r(n),s.d(n,{__N_SSG:function(){return o}});var a=s(5893),i=s(1151);function r(e){let n=Object.assign({h1:"h1",p:"p",code:"code",h2:"h2",ul:"ul",li:"li",pre:"pre"},(0,i.ah)(),e.components);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.h1,{children:"Filters"}),"\n",(0,a.jsxs)(n.p,{children:["The search requests accept an ",(0,a.jsx)(n.code,{children:"filter"})," paramenter. You can us it construct complex filters using a simplified syntax."]}),"\n",(0,a.jsx)(n.h2,{id:"operatos",children:"Operatos"}),"\n",(0,a.jsx)(n.p,{children:"You can combine filter clauses using the following logical operators to create complex queries."}),"\n",(0,a.jsxs)(n.ul,{children:["\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.code,{children:"AND"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.code,{children:"OR"})}),"\n",(0,a.jsx)(n.li,{children:(0,a.jsx)(n.code,{children:"AND NOT"})}),"\n"]}),"\n",(0,a.jsx)(n.p,{children:"Parentheses can be used to group clauses in a filter query, which specifies the order in which they are executed."}),"\n",(0,a.jsx)(n.p,{children:"For example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:'is:active AND (category:"action" OR category:"horror") AND NOT stock:0\n',children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">is:active AND (category:</span><span style="color: var(--shiki-token-string-expression)">&quot;action&quot;</span><span style="color: var(--shiki-color-text)"> OR category:</span><span style="color: var(--shiki-token-string-expression)">&quot;horror&quot;</span><span style="color: var(--shiki-color-text)">) AND NOT stock:0</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.p,{children:"Let's explore the available filters with examples."}),"\n",(0,a.jsx)(n.h2,{id:"not",children:"Not"}),"\n",(0,a.jsx)(n.p,{children:"To create a negative filter, you can prefix the filter value with NOT."}),"\n",(0,a.jsx)(n.pre,{code:"NOT {filter_clause}\n",children:(0,a.jsx)(n.code,{children:"NOT {filter_clause}\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:'NOT category:"action"\n',children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">NOT category:</span><span style="color: var(--shiki-token-string-expression)">&quot;action&quot;</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"equals",children:"Equals"}),"\n",(0,a.jsx)(n.p,{children:"The equals syntax is used to filter for concrete values."}),"\n",(0,a.jsx)(n.p,{children:"This operator is useful when you want to filter your search based on a particular field value."}),"\n",(0,a.jsx)(n.pre,{code:'{field}:"{value}"\n',children:(0,a.jsx)(n.code,{children:'{field}:"{value}"\n'})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:'category:"action"\n',children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">category:</span><span style="color: var(--shiki-token-string-expression)">&quot;action&quot;</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"is",children:"Is"}),"\n",(0,a.jsxs)(n.p,{children:["To filter is a boolean field is ",(0,a.jsx)(n.code,{children:"true"})," use the ",(0,a.jsx)(n.code,{children:"is"})," operator."]}),"\n",(0,a.jsx)(n.pre,{code:"is:{field}\n",children:(0,a.jsx)(n.code,{children:"is:{field}\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:"is:active\n",children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">is:active</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"is-not",children:"Is not"}),"\n",(0,a.jsxs)(n.p,{children:["To filter is a boolean field is ",(0,a.jsx)(n.code,{children:"false"})," use the ",(0,a.jsx)(n.code,{children:"is_not"})," operator."]}),"\n",(0,a.jsx)(n.pre,{code:"is_not:{field}\n",children:(0,a.jsx)(n.code,{children:"is_not:{field}\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:"is_not:active\n",children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">is_not:active</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"in",children:"In"}),"\n",(0,a.jsxs)(n.p,{children:["You can use the ",(0,a.jsx)(n.code,{children:"in"})," operator if you need to filter for multiple values in a field."]}),"\n",(0,a.jsx)(n.pre,{code:"{field}:[{value1}, {value2}]\n",children:(0,a.jsx)(n.code,{children:"{field}:[{value1}, {value2}]\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:'category:["action", "horror"]\n',children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">category:[</span><span style="color: var(--shiki-token-string-expression)">&quot;action&quot;</span><span style="color: var(--shiki-color-text)">, </span><span style="color: var(--shiki-token-string-expression)">&quot;horror&quot;</span><span style="color: var(--shiki-color-text)">]</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"range",children:"Range"}),"\n",(0,a.jsxs)(n.p,{children:["You can accomplish filtering various ranges using the range operators ",(0,a.jsx)(n.code,{children:">"}),", ",(0,a.jsx)(n.code,{children:"<"}),", ",(0,a.jsx)(n.code,{children:"<="}),", ",(0,a.jsx)(n.code,{children:">="}),"."]}),"\n",(0,a.jsx)(n.pre,{code:"{field}{operator}{value}\n",children:(0,a.jsx)(n.code,{children:"{field}{operator}{value}\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:"stock>0\n",children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">stock</span><span style="color: var(--shiki-token-keyword)">&gt;</span><span style="color: var(--shiki-color-text)">0</span></span>\n<span></span>'})}),"\n",(0,a.jsx)(n.h2,{id:"geo-distance",children:"GEO Distance"}),"\n",(0,a.jsx)(n.p,{children:"You can filter on a Geo Point field like this"}),"\n",(0,a.jsx)(n.pre,{code:"{field}:{distance}{unit}[{latitide},{longtitude}]\n",children:(0,a.jsx)(n.code,{children:"{field}:{distance}{unit}[{latitide},{longtitude}]\n"})}),"\n",(0,a.jsx)(n.p,{children:"Example:"}),"\n",(0,a.jsx)(n.pre,{language:"bash",code:"location:10km[51.49,13.77]\n",children:(0,a.jsx)(n.code,{className:"language-bash",children:'<span><span style="color: var(--shiki-color-text)">location:10km[51.49,13.77]</span></span>\n<span></span>'})})]})}var o=!0;n.default=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{wrapper:n}=Object.assign({},(0,i.ah)(),e.components);return n?(0,a.jsx)(n,Object.assign({},e,{children:(0,a.jsx)(r,e)})):r(e)}}},function(e){e.O(0,[774,888,179],function(){return e(e.s=8341)}),_N_E=e.O()}]);