Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dadoonet/legacy-search
Demo project showing how to add elasticsearch to a legacy application.
https://github.com/dadoonet/legacy-search
demo elasticsearch nosql sql
Last synced: 13 days ago
JSON representation
Demo project showing how to add elasticsearch to a legacy application.
- Host: GitHub
- URL: https://github.com/dadoonet/legacy-search
- Owner: dadoonet
- Created: 2014-05-05T15:43:20.000Z (over 10 years ago)
- Default Branch: 00-legacy
- Last Pushed: 2024-09-27T04:31:05.000Z (about 2 months ago)
- Last Synced: 2024-10-16T14:23:35.952Z (28 days ago)
- Topics: demo, elasticsearch, nosql, sql
- Language: Java
- Size: 1.16 MB
- Stars: 111
- Watchers: 12
- Forks: 44
- Open Issues: 6
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
Add Search to Legacy Application
================================Introduction
------------This is a demo project to show how to add elasticsearch to a legacy SQL project.
In this branch, you will find the current legacy version of the project.
Installation
------------You need to have:
* Maven
* JDK8 or higher
* DockerRun MySQL database using docker with:
```shell
./mysql.sh
```Build the application:
```sh
mvn clean install
```Then run it with:
```
java -jar target/legacy-search-8.0-SNAPSHOT.jar
```Or directly run from Maven:
```sh
mvn clean spring-boot:run
```Note that while developing, you would probably prefer running `LegacySearchApp#main()`
from your IDE to get hot reload of the application.Play!
-----### Some CRUD operations
```sh
# Create one person
curl -XPUT http://127.0.0.1:8080/api/1/person/1 -H "Content-Type: application/json" -d '{"name":"David Pilato"}'# Read that person
curl http://127.0.0.1:8080/api/1/person/1# Update full document
curl -XPUT http://127.0.0.1:8080/api/1/person/1 -H "Content-Type: application/json" -d '{"name":"David Pilato", "children":3}'# Check
curl http://127.0.0.1:8080/api/1/person/1# Delete
curl -XDELETE http://127.0.0.1:8080/api/1/person/1# Check (you should get a 404 error)
curl http://127.0.0.1:8080/api/1/person/1
```### Database Initialisation
```sh
# Initialize the database with 1 000 (default) or 10 000 persons
curl http://127.0.0.1:8080/api/1/person/_init
curl http://127.0.0.1:8080/api/1/person/_init?size=10000
```## Search
```sh
# Search for something (`a la google`)
curl "http://127.0.0.1:8080/api/1/person/_search?q=Joe"
```You can then access the application using your browser: [http://127.0.0.1:8080/](http://127.0.0.1:8080/).
You can also look at [advanced search](http://127.0.0.1:8080/#/advanced).Next step
---------Look at [branch 01-direct](https://github.com/dadoonet/legacy-search/tree/01-direct)