import requests
import parsel
import csv
from elasticsearch import Elasticsearch
es = Elasticsearch(["https://localhost:9200"], basic_auth=('elastic', 'hw-FxQTckOuswZ1jRikA'), verify_certs=False,
request_timeout=3600)
print(es)
INDEX_NAME = "jd-produict-list"
mappings = {
"mappings": {
"properties": {
"name": {
"type": "text"
},
"price": {
"type": "text"
},
"link": {
"type": "text",
"index": "false"
},
"shop": {
"type": "text",
}
}
}
}
res1 = es.options(ignore_status=404).indices.delete(index=INDEX_NAME)
res = es.indices.create(index=INDEX_NAME, body=mappings)
print(res)
url = ("https://api.m.jd.com/?appid=search-pc-java&functionId=pc_search_s_new&client=pc&clientVersion=1.0.0&t"
"=1713168142494&body=%7B%22keyword%22%3A%22java%22%2C%22pvid%22%3A%22555ce3e0d8264f2d91d2a39ce764254d%22%2C"
"%22page%22%