Skip to content

Instantly share code, notes, and snippets.

@ashokc
Created February 16, 2020 19:33
Show Gist options
  • Save ashokc/7c2e8973b5cc0465d5572be3b22ce1dc to your computer and use it in GitHub Desktop.
Save ashokc/7c2e8973b5cc0465d5572be3b22ce1dc to your computer and use it in GitHub Desktop.
from flask import Flask, request, render_template, logging
from elasticsearch import Elasticsearch
client = Elasticsearch([{'host':'localhost','port':9200}])
app = Flask(__name__)
@app.route('/quotes/byId', methods=['GET'])
def getById():
docId = request.args.get('id')
quote = client.get(index=index, id=docId)
return render_template('quote.html',quote=quote)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment