Skip to content

caaespin/APITest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

APITest

Simple Flask web service to communicate with ElasticSearch and output the list of results in JSON format.

Instructions

***Assumptions***
-You have ElasticSearch 2.4.1 installed
-You have virtualenv installed

In case you don't have virtualenv installed, you can do so by:
``` sudo easy_install virtualenv ```
1.-Download this repo by using `git clone https://github.com/caaespin/APITest.git`
2.-The repo includes a sample jsonl file called elasticsearch.jsonl. It is a sample search index for testing purposes. Use `curl -XPOST "http://localhost:9200/mfiles/mfile/_bulk?pretty" --data-binary @elasticsearch.jsonl` to index the data in elasticsearch.jsonl.
3.-Use `virtualenv venv` to set up your virtualenv. Activate it using `. venv/bin/activate`
4.-In case you don't have Flask and the Flask ElasticSearch client, use: ``` pip install Flask pip install Flask-Elasticsearch ```
5.-Once you have that, start your Elasticsearch copy in another terminal window. Back where you have your virtual environment, do: ``` export FLASK_APP=mapi.py flask run ```
This will start the app.
6.-Open your browser and go to `http://127.0.0.1:5000/` to see the API response.

About

Test for a web service using Flask

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages