第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

嘗試使用 elasticsearch-dsl Python 包訪問 Elasticsearch

嘗試使用 elasticsearch-dsl Python 包訪問 Elasticsearch

絕地?zé)o雙 2022-06-28 10:41:16
我正在試驗(yàn) Elasticsearch 并使用elasticsearch-dslPython 包索引一些 Django 數(shù)據(jù)。我創(chuàng)建了一個(gè)相對(duì)基本的測(cè)試,search.py但是當(dāng)我嘗試索引任何數(shù)據(jù)時(shí)收到連接錯(cuò)誤。from elasticsearch_dsl.connections import connectionsfrom elasticsearch_dsl import Document, Textfrom elasticsearch.helpers import bulkfrom elasticsearch import Elasticsearchfrom . import modelsconnections.create_connection(hosts=['ELASTICSEARCH_ENDPOINT_URL'],                              http_auth='USERNAME:PASSWORD')class MyIndex(Document):    title = Text()    description = Text()    class Index:        name = 'my-index'def bulk_indexing():    MyIndex.init()    es = Elasticsearch()    bulk(client=es, actions=(a.indexing() for a in models.MyModel.objects.all().iterator()))當(dāng)我運(yùn)行時(shí),bulk_indexing()我收到以下錯(cuò)誤:elasticsearch.exceptions.ConnectionError: ConnectionError(<urllib3.connection.HTTPConnection object at 0x1282266d8>: Failed to establish a new connection: [Errno 61] Connection refused) caused by: NewConnectionError(<urllib3.connection.HTTPConnection object at 0x1282266d8>: Failed to establish a new connection: [Errno 61] Connection refused)我懷疑語法錯(cuò)誤或在創(chuàng)建連接時(shí)丟失了一些憑據(jù),但我找不到任何進(jìn)一步的信息。我正在使用使用 Elastic Cloud 部署的 Elasticsearch v7.4.0。當(dāng)我通過瀏覽器訪問 URL 時(shí),我可以連接。
查看完整描述

1 回答

?
慕田峪9158850

TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊

為什么不簡(jiǎn)單地使用您的 Cloud ID(您可以在 ES Cloud 控制臺(tái)中找到)?


from elasticsearch import Elasticsearch

es = Elasticsearch(cloud_id="<some_long_cloud_id>", http_auth=('USERNAME','PASSWORD'))


查看完整回答
反對(duì) 回復(fù) 2022-06-28
  • 1 回答
  • 0 關(guān)注
  • 159 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)