def health(h): try: response = base.es.cat.health(h=h, format='json') table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def fielddata(fields, format, h): try: response = base.es.cat.fielddata(fields=fields, bytes=format, h=h, format='json') table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def shards(index, h): try: response = base.es.cat.shards(index=index, h=h, format='json') if not response: click.echo("No Shards present") return table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def repositories(h): try: response = base.es.cat.repositories(h=h, format='json') if not response: click.echo("No Repositories as of now") return table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def recovery(index, format, h): try: response = base.es.cat.recovery(index=index, bytes=format, h=h, format='json') table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def nodeattrs(h): try: response = base.es.cat.nodeattrs(h=h, format='json') if not response: click.echo("No attributes as of now") return table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def count(index, h): ''' Gives count of the documents stored in Elasticsearch. If index option is provided, it will provide document count of that index. ''' try: response = base.es.cat.count(index, h=h) table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def snapshots(repository, h): try: response = base.es.cat.snapshots(repository=repository, h=h, format='json') if not response: click.echo("No snapshots present") return table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def allocation(node, format, h): ''' Allocation provides a snapshot of how shards have located around the cluster and the state of disk usage ''' try: response = base.es.cat.allocation(node_id=node, bytes=format, h=h, format='json') table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)
def indices(index, h): ''' The indices command provides a cross-section of each index. This information spans nodes. We can tell quickly how many shards make up an index, the number of docs, deleted docs, primary store size, and total store size (all shards including replicas). All these exposed metrics come directly from Lucene APIs. ''' try: response = base.es.cat.indices(index, h=h, format='json') table = base.draw_table(response) except Exception as e: click.echo(e) else: click.echo(table)