0

I have ElasticSearch iterated data like this:

(Pdb) data[0]
     {'_index': 'publishserdata-index',
      '_type': 'publishser_data_index', 
      '_id': '35', '_score': 1.0, 
      '_source': {'publisher': 'Admin',
                 'department': 'IT', 
                 'subdepartment': 'Full Stack Developer',
                 'inventory_ID': 'IT003',
                 'title': 'Why Should I Use Celery?', }}

I want to get publisher, department, title data.

when I iterate value in templates:-

{% for d in data %}
       {{d._source.publisher}}/error
{% endfor %}
Mr Singh
  • 3,936
  • 5
  • 41
  • 60

1 Answers1

1

As that code shows, data[0] is a dict. So you use normal dict syntax to access its contents: data[0]['_source'], etc.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895