ElasticsearchDeprecationWarning: Need some clarification to make corrections

Hi Guys,

I am new to ES, I recently integrated ES in my Django project by following.
https://django-elasticsearch-dsl.readthedocs.io/en/latest/quickstart.html

Versions used:

django-elasticsearch-dsl==7.1.4
django-elasticsearch-dsl-drf==0.20.9

elasticsearch==7.10.1
elasticsearch-dsl==7.3.0

Elastic search version:
"version" : {
"number" : "7.10.1",
"build_flavor" : "default",
"build_type" : "deb",
"build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
"build_date" : "2020-12-05T01:00:33.671820Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},

Whenever my Django makes the connection for the first time it throws this error (after the first time of any query it won't show).

/home/user/Documents/work/Project/env/lib/python3.6/site-packages/elasticsearch/connection/base.py:193: ElasticsearchDeprecationWarning: this request accesses system indices: [.security-7], but in a future major version, direct access to system indices will be prevented by default warnings.warn(message, category=ElasticsearchDeprecationWarning)

I am using auth with username and password in setting.py:

ELASTICSEARCH_DSL = {
'default': {
'hosts': 'localhost:9200',
'http_auth': ('elastic', 'my_pwd')
}
}

ELASTICSEARCH_DSL_INDEX_SETTINGS = {
'number_of_shards': 1,
'number_of_replicas': 0
}

I tried finding everything on the web to find something but to no avail. Can someone please clarify what this warning means and how I can rectify it? Thanks.

Best Regards,
Varshap

This should not impact your app on anyhing since you are not using system index naming convention (start with .)

1 Like

Hey, Thanks For the reply, Can you please elaborate on that.

My index names:

CMD:
curl -XGET -u elastic:my_pwd 'localhost:9200/_alias'

Result:
{"product":{"aliases":{}},".security-7":{"aliases":{".security":{}}}}

This .security-7 index got auto-added when I ran cmd to setup my auth(username/pwd):

sudo bin/elasticsearch-setup-passwords interactive

I also have xpack.security.enabled: true in my config.

I'm expecing next releases will not allow targetting any action via Rest API to any system index
So deprecation warnings are used to prevent you that and telling what will happens

For now, existing clients like what you are using (elasticsearch-dsl ...) will be updated in next release to comply with this breaking change

1 Like