1

私はPythonを使用してelastisearchを使用しています。私のコードは次のように多少なります -Pythonを使用したElasticsearchクエリのユーザ認証

from elasticsearch import Elasticsearch 

if __name__ == '__main__': 
index="IndexPosition" 
es=Elasticsearch(['https://localhost:8080']) 
res = es.search(index='{0}'.format(index), doc_type="log",size=1000, from_=0, body={ "query": { 
"match": { 

    ...Match condition 
    } 
} 

}})

さて、アーキテクチャのユーザ認証の変更にelasticsearch.Letの前提としたユーザー名、ユーザーに追加されたためとpassword-pass.How DO私は、クエリでユーザー名とパスワードを渡す..?

答えて

1

以下に示すようにESの接続を取得しているときは、ユーザ名とパスワードを渡す必要があります:

ES = Elasticsearch([ 'http://localhost:8080 ']、HTTP_AUTH =(' ユーザー'、 'パス'))

関連する問題