Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/confact/elasticsearch-codeigniter-library
A small library to make search queries and create and add indexes.
https://github.com/confact/elasticsearch-codeigniter-library
elasticsearch php
Last synced: about 2 months ago
JSON representation
A small library to make search queries and create and add indexes.
- Host: GitHub
- URL: https://github.com/confact/elasticsearch-codeigniter-library
- Owner: confact
- License: mit
- Archived: true
- Created: 2013-08-15T13:38:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-12-28T17:33:11.000Z (almost 5 years ago)
- Last Synced: 2024-05-06T00:04:54.661Z (8 months ago)
- Topics: elasticsearch, php
- Language: PHP
- Size: 9.77 KB
- Stars: 52
- Watchers: 16
- Forks: 51
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-codeigniter - elasticsearch-codeigniter-library - A small library to make search queries. (Libraries)
README
elasticsearch-codeigniter-library
=================================A small library to make search queries and create and add indexes.
## How to index data with the library
You create data in an array to pass it to elasticsearch. You probably want to specify the Key for the document and show the result. Like this:$id = 1337;
$data = array("name"=>"nisse", "age"=>"14", "sex"=>"male");
var_dump($this->elasticsearch->add("people", $id, $data));
This will save the array to the elasticsearch. "people" is the collection, the index where you want to save it.# CRUD Operations
## CREATE
$id = 1337;
$data = array("name"=>"nisse", "age"=>"14", "sex"=>"male");
$return = $this->elasticsearch->add("people", $id, $data);## READ
$id = 1337;
$this->elasticsearch->get("people", $id);## UPDATE
$id = 1337;
$data = array(
"id" => $id,
"name"=>"nisse",
"age"=>"14",
"sex"=>"male"
);
$return = $this->elasticsearch->add("people", $id, $data);## DELETE
$id = 1337;
$this->elasticsearch->delete("people", $id);