Skip to content

Instantly share code, notes, and snippets.

import json
import openai
from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
es = Elasticsearch(
[{'host': 'localhost', 'port': 9200, 'scheme': 'http'}])
openai.api_key = 'key'
[
{"code": 1, "title": "The Shawshank Redemption", "genre": ["Drama"], "director": "Frank Darabont", "actors": ["Tim Robbins", "Morgan Freeman", "Bob Gunton", "William Sadler"], "description": "Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.", "year": 1994, "runtime": "142 min", "rating": 9.3, "votes": 2343110, "revenue": "28,341,469", "metascore": 80, "certificate": "A", "avatar": "https://m.media-amazon.com/images/M/MV5BMDFkYTc0MGEtZmNhMC00ZDIzLWFmNTEtODM1ZmRlYWMwMWFmXkEyXkFqcGdeQXVyMTMxODk2OTU@._V1_UX67_CR0,0,67,98_AL_.jpg"}
,
{"code": 2, "title": "The Godfather", "genre": ["Crime", "Drama"], "director": "Francis Ford Coppola", "actors": ["Marlon Brando", "Al Pacino", "James Caan", "Diane Keaton"], "description": "An organized crime dynasty's aging patriarch transfers control of his clandestine empire to his reluctant son.", "year": 1972, "runtime": "175 min", "rating": 9.2, "votes": 1620367, "revenue": "134,966,411", "metascore": 100,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Marketplace Facets</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;