A library to make easy use of elasticsearch in C++ projects similar to the Python elasticsearch package.
The code has only been tested on Linux so far.
To get the best results note the following:
- C++ version >= 20
- CMake version >= 3.25
- Elasticsearch version >= 7.5
- libcurl version >= 7.17.0
- simdjson
- nlohmann/json
-
git clone --recurse-submodules -j8 https://github.com/m1guelperez/elasticsearch_client.git
-
- on Debian based distributions via:
sudo apt-get update && sudo apt install libcurl
- on Arch via:
sudo pacman -S curl
-
-
HOST=<HOST> PORT=<PORT>
-
Depending on your usage, I highly recommend you to eventually install the nlohmann
library
for pretty printing/debugging and the simdjson
library for faster parsing.
include(FetchContent)
FetchContent_Declare(json
URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(json)
target_link_libraries(<your_target> PRIVATE nlohmann_json::nlohmann_json)
include(FetchContent)
FetchContent_Declare(
simdjson
GIT_REPOSITORY https://github.com/simdjson/simdjson.git
GIT_SHALLOW TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE)
FetchContent_MakeAvailable(simdjson)
target_link_libraries(<your_target> PRIVATE simdjson)
- Set up default curl
- Provide more curl options
- Create easy-query/raw-string interface
- Add configfile support
- Add all elasticsearch request types (e.g search, update, ...)
- Response processing (extract JSON values)
- Add json parsing functionality
- Add pretty print for queries
- Make fully functional Querybuilder
- Add all elasticsearch query parameters
- Rewrite logging
Distributed under the MIT License.