Faceting Numbers
  • 14 Oct 2021
  • 1 Minute to read
  • Dark
    Light

Faceting Numbers

  • Dark
    Light

Article summary

Faceting Query Numbers

Numeric values are treated differently than date values. All values are absolute and, just like date values, order must be respected.

Numbers support file size suffixes (e.g., "MB" or "M" for megabytes), or scientific notation (1e6 for 1 million). The gaps that delineate bins within the range can be non-uniform.

Example:

https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:0, end:100, gap:10)

Response:

...
<facets>
  <facet name="contentlength" type="number">
    <bins>
      </bin range="[0 TO 10}">13</bin>
      </bin range="[10 TO 20}">3</bin>
      </bin range="[20 TO 30}">5</bin>
      </bin range="[30 TO 40}">0</bin>
      </bin range="[40 TO 50}">0</bin>
      </bin range="[50 TO 60}">0</bin>
      </bin range="[60 TO 70}">0</bin>
      </bin range="[70 TO 80}">0</bin>
      </bin range="[80 TO 90}">0</bin>
      </bin range="[90 TO 100}">0</bin>
    </bins>
  </facet>
</facets>

If you specify bins outside the beginning and ending range, they are ignored.

Example:

https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:0, end:100M, gap:{1k, 100k, 10M, 101M})

Response:

...
<facets>
  <facet name="contentlength" type="number">
    <bins>
      </bin range="[0 TO 1024}">13</bin>
      </bin range="[1024 TO 102400}">3</bin>
      </bin range="[102400 TO 10485760}">5</bin>
      </bin range="[10485760 TO 104857600}">0</bin>
    </bins>
  </facet>
</facets>

Numeric values cannot be defined from the end value. The following queries would result in an error.

Example:

https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:-100, end:100 gap:-10)
https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:0, end:100M, gap:{10M, 100k, 1k})

Response:

Error

Numeric Values and Multipliers

Numeric values can also use multipliers ( xN values ) and exponents ( ^N values ).

Example:

https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:0, end:1e8, gap:x10)

Response:

...
<facets>
  <facet name="contentlength" type="number">
    <bins>
      </bin range="[0 TO 10}">13</bin>
      </bin range="[10 TO 100}">3</bin>
      </bin range="[100 TO 1000}">5</bin>
      </bin range="[1000 TO 10000}">5</bin>
      </bin range="[10000 TO 100000}">0</bin>
      </bin range="[100000 TO 1000000}">5</bin>
      </bin range="[1000000 TO 10000000}">0</bin>
      </bin range="[10000000 TO 100000000}">0</bin>
    </bins>
  </facet>
</facets>

Using a multiplier value across zero is considered invalid, because you cannot multiply a negative number and ever be larger than 0

Example:

https://<appliance_ip>/search?q=data&facets=contentlength:range(begin:-5, end:5, gap:x2)

Response:

Error

Was this article helpful?