7

I have a search query to make across multiple indexes. To enable this as per the documentation, I need to provide a comma-separated list of indexes.

enter image description here But when I try to do it as: es.search(index='index1,index2',body=body)

I get no result: {u'hits': {u'hits': [], u'total': 0, u'max_score': None}, u'_shards': {u'successful': 10, u'failed': 0, u'skipped': 0, u'total': 10}, u'took': 1, u'timed_out': False}

However, index='_all' works to search across all index. Am I doing something incorrectly here or is there some issue with this functionality? Thanks.

Amogh Mishra
  • 1,088
  • 1
  • 16
  • 25

1 Answers1

15

According to the documentation posted by you:

  • index a comma separated list... (enphasys is mine)

In your code you pass a string:

es.search(index='index1,index2',body=body)

So you should simply:

es.search(index=['index1','index2'],body=body)
Lupanoide
  • 3,132
  • 20
  • 36