0
0
Elasticsearchquery~10 mins

Authentication basics in Elasticsearch - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the username for basic authentication.

Elasticsearch
client = Elasticsearch(http_auth=([1], 'mypassword'))
Drag options to blanks, or click blank then click option'
A'elastic'
B'password123'
C'user1'
D'admin'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the password as the first value instead of the username.
Using an incorrect username string.
2fill in blank
medium

Complete the code to enable SSL verification in the Elasticsearch client.

Elasticsearch
client = Elasticsearch(ssl_show_warn=False, verify_certs=[1])
Drag options to blanks, or click blank then click option'
A'yes'
BNone
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using a string instead of a boolean.
Disabling SSL verification by setting it to False.
3fill in blank
hard

Fix the error in the code to correctly pass the API key for authentication.

Elasticsearch
client = Elasticsearch(api_key=[1])
Drag options to blanks, or click blank then click option'
Ab64encode('api_key')
B'my_api_key'
C('id', 'api_key')
D('id', 'api_key'.encode())
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the API key as a plain string.
Not encoding the API key to bytes.
4fill in blank
hard

Fill both blanks to create a dictionary with username and password for HTTP basic authentication.

Elasticsearch
auth = {'username': [1], 'password': [2]
Drag options to blanks, or click blank then click option'
A'elastic'
B'mypassword'
C'admin'
D'secret'
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping username and password values.
Using incorrect strings for username or password.
5fill in blank
hard

Fill all three blanks to create a secure Elasticsearch client with username, password, and SSL verification enabled.

Elasticsearch
client = Elasticsearch(http_auth=([1], [2]), verify_certs=[3])
Drag options to blanks, or click blank then click option'
A'elastic'
B'mypassword'
CTrue
DFalse
Attempts:
3 left
💡 Hint
Common Mistakes
Disabling SSL verification by setting it to False.
Using incorrect username or password strings.