/php_api

A PHP RESTful API connecting to ElasticSearch

Primary LanguagePHP

PHP ElasticSearch API

Setup

Currently this demo is connecting to an Elasticsearch NoSql database that is run locally. This was made with version 6.2.4

Dependencies are installed with Composer

composer.json

{
  "require": {
    "elasticsearch/elasticsearch": "^6.2.4"
  } 
}

Endpoints

A basic CRUD RESTful api.

Create

method: POST

desc: create a new record

url: http://localhost:9000/api/create

body

{
  "uwi": "11111111W400",
  "name": "wellname",
  "account": "1234567890"
}

Read

method: GET

desc: read records from specific account#

url: http://localhost:9000/api/read/1234567890

Update

method: POST

desc: update a record by id

url: http://localhost:9000/api/update

body

{
  "uwi": "11111111W400",
  "name": "wellname",
  "account": "1234567890",
  "id": "aTlJo2oBu3wb5VBPH4Uj"
}

Delete

method: POST

desc: delete a record by id

url: http://localhost:9000/api/delete

body

{
  "id": "aTlJo2oBu3wb5VBPH4Uj"
}

Search

method: GET

desc: read all records

url: http://localhost:9000/api/search