from elasticsearch_dsl import connections
from elasticsearch_dsl import Search,Q as esQ
es_client = connections.create_connection(hosts=['192.168.214.132'],port=9200, http_auth="elastic:ellischen")
search = Search(using=es_client,index="test*")
search.query = esQ('nested', **{'path': 'test', 'query': esQ('wildcard', **{'test.d.wildcard': {'value': '*2*'}})})
search.query = esQ('nested', **{'path': 'test', 'query': {'wildcard':{'test.d.wildcard': {'value': '*2*'}}}})
value = search.execute()
result = value['hits']['hits'][0:2]
for item in result:
print(item['_source'])
print(result)