Installation

elasticsearch-lua has the following requirements:

  • Lua 5.1 or higher

There are two ways to install elasticsearch-lua:

Using luarocks

luarocks is the package manager for Lua modules. To install Lua and LuaRocks luaver can be used. You can directly install elasticsearch-lua using LuaRocks:

$ luarocks install elasticsearch

The client will be installed and you can require ‘elasticsearch’ anywhere in your Lua code. If elasticsearch-lua is a dependency, add it in your rockspec file:

dependencies = {
  "elasticsearch"
}

Directly from source

elasticsearch-lua can also be installed directly from the source. However this is not recommended.

  • Clone the repository:

    git clone https://github.com/DhavalKapil/elasticsearch-lua.git
    
  • Install the following dependencies:

Note

lunitx is not needed for using the client. You will need to install it only if you wish to run tests.

  • Add the following code to use elasticsearch-lua:

    package.path = package.path .. ";/path/to/elasticsearch-lua/src/?.lua";
    
    local elasticsearch = require "elasticsearch";