/
Elasticsearch queries- direct to ES

Elasticsearch queries- direct to ES

This article will give a few examples of doing direct-to-Elasticsearch queries. This is normally not necessary and not advised as queries should be done through the Swarm Search API.

Preparation

  • Set a Swarm Node IP as SCSP_HOST, Elasticsearch IP and the Elasticsearch Index variables. These presume the Support tools are installed at /root/dist

export SCSP_HOST=<any Swarm node> export ESIP=$(python /root/dist/platform-get-default-search-feed-ip.py $SCSP_HOST | awk '{ print $1 }') export ESINDEX=index_$(python /root/dist/platform-get-default-search-index-name.py $SCSP_HOST)

Calls direct to ES

ES information by stream name

FILENAME=<filename> && curl -s "$ESIP:9200/$ESINDEX/_search?q=stype:NAMED+AND+name:$FILENAME&pretty" | jq -r '.hits.hits[]'
  • This will return all named streams by that name across buckets/ domains. You can delineate by bucket or domain id as seen in other examples.

ES information by etag

ETAG=<etag> && curl -s "$ESIP:9200/$ESINDEX/_search?pretty&q=etag:$ETAG" | jq '.hits.hits[]'

Get bucket name, etag, and tmBorn by bucket name

  • This might be handy for recreating a recently deleted bucket

Get Domain id

from Swarm

from ES directly

Get Bucket id (context id)

from Swarm by domain name

from ES directly- by domain id

Stream count by bucket (context id)

Streams by bucket (context id)

Stream count by Domain (domain id)

Related content

Gateway Logging
Gateway Logging
Read with this
Using the python elasticsearch SDK to list objects in a bucket
Using the python elasticsearch SDK to list objects in a bucket
More like this
Migrating Swarm Components from CentOS 7 to Rocky Linux 8
Migrating Swarm Components from CentOS 7 to Rocky Linux 8
Read with this
Elasticsearch Implementation
Elasticsearch Implementation
More like this
S3 Object Locking
S3 Object Locking
Read with this
Search Examples
Search Examples
More like this

© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.