24 May 2022
Elastic: Group_By and sort
get /my_index/_search
{
"query": {
"bool": {
"filter": [
{
"range": {
"block_time": {
"gt": "2013-11-21T05:17:33",
"lt": "2023-11-19T10:30:33"
}
}
},
{
"term": {
"mytoken": "token14"
}
}
]
}
},
"_source": false,
"aggs": {
"block_height_agg": {
"terms": {
"field": "block_height",
"size": 5,
"order": {"_key": "desc"}
}
}
},
"size": 3
}
Example to GROUP BY block_height and SORT it
18 May 2022
Get https certificate
Certificate:
openssl s_client -connect <host>:<port> < /dev/null 2>/dev/null
Fingerprint of certificate:
openssl s_client -connect <host>:<port> < /dev/null 2>/dev/null | openssl x509 -fingerprint -noout -in /dev/stdin17 May 2022
Elastic cert use Letsencrypt
xpack.security.http.ssl.key: certs/privkey.pem
xpack.security.http.ssl.certificate: certs/fullchain.pem
xpack.security.http.ssl.certificate_authorities: [ "certs/chain.pem" ]https://github.com/CollectionBuilder/collectionbuilder-sa_draft/issues/37
Setup Elastic 8 cluster
setup the initial master mode:
https://towardsdev.com/elasticsearch-8-express-installation-guide-6065d89141d8
for other node, need to copy the certificate from the master node. otherwise they cannot join the cluster.
##
There are http.ssl and transportation.ssl
http.ssl is for client(kibana, logstash, or your custome code) to connect to elastic. Ports 9200
transportation.ssl is for the node in the cluster to communicate among themself . Ports 9300.
Elastic suggest to use different ca and certs for http
22 April 2022
Increase shards limit in elastic
PUT /_cluster/settings
{ "persistent" : {
"cluster.max_shards_per_node": "1500"
}
}
"cluster.max_shards_per_node": "1500"
}
}
Ref:
https://stackoverflow.com/questions/63700998/how-to-increase-cluster-settings-cluster-max-shards-per-node-for-aws-elasticsea
12 April 2022
Subscribe to:
Posts (Atom)


