mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-20 18:12:35 +00:00
Templates (#12294)
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com> Co-authored-by: Lance Martin <lance@langchain.dev> Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
This commit is contained in:
21
templates/elastic-query-generator/ingest.py
Normal file
21
templates/elastic-query-generator/ingest.py
Normal file
@@ -0,0 +1,21 @@
|
||||
import os
|
||||
from elasticsearch import Elasticsearch
|
||||
|
||||
es_host = os.environ["ELASTIC_SEARCH_SERVER"]
|
||||
es_password = os.environ["ELASTIC_PASSWORD"]
|
||||
|
||||
db = Elasticsearch(
|
||||
es_host,
|
||||
http_auth=('elastic', es_password),
|
||||
ca_certs='http_ca.crt' # Replace with your actual path
|
||||
)
|
||||
|
||||
customers = [
|
||||
{"firstname": "Jennifer", "lastname": "Walters"},
|
||||
{"firstname": "Monica","lastname":"Rambeau"},
|
||||
{"firstname": "Carol","lastname":"Danvers"},
|
||||
{"firstname": "Wanda","lastname":"Maximoff"},
|
||||
{"firstname": "Jennifer","lastname":"Takeda"},
|
||||
]
|
||||
for i, customer in enumerate(customers):
|
||||
db.create(index="customers", document=customer, id=i)
|
Reference in New Issue
Block a user