Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
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)
Esempio n. 5
0
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)
Esempio n. 6
0
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)
Esempio n. 7
0
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)
Esempio n. 8
0
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)
Esempio n. 9
0
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)
Esempio n. 10
0
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)