Elistix v1.0.1 Elistix.Index

This module makes all the operations related to the indices in Elasticsearch.

Summary

Functions

Create a new index

Show index stats

Populate with data any index

Refresh the index to get ready for search

Delete an index

Functions

create_index(name, type)

Create a new index.

Attributes are two strings with the name of the index and the type.

index_stats(name)

Show index stats

You need to specify the name of the index you want to get the stats.

See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-stats.html to get more details about this.

load_data(name, type, data)

Populate with data any index.

Attributes are two strings with the name of the index and the type, the third attribute is a JSON that contains the data you want to save.

The data attribute is a JSON with key and value with the information you want to save.

Examples

data = ‘{ “id” : 1, “name” : “Order item for id 1”, “status” : “good” }’

load_data(“tests”, “test”, data)

refresh(name)

Refresh the index to get ready for search.

Specify the name of the index you want to refresh. You can refresh the index making all operations performed available for search.

remove_index(name)

Delete an index.

You need to specify the name of the index to remove.