aparo/pyes — Issue #148: meta and _source should not be returned at the same level
Author: drawks
Created: 2012-01-05 19:18:03+00:00
State: open

When using the .17 trunk code's new iterator search the resultant records are return with a "meta" k/v at the top level of the dict like object. However the contents of the "_source" object are also returned at the top level. This means both that a field named "meta" cannot be safely returned as a result AND that the search result cannot be sent back to ES for reindexing without first deleting the result['meta'] first as otherwise the ES.connection object will cause a recursion in the code path.

```python
import pyes
conn = pyes.ES('localhost:9200', timeout=600, bulk_size=20000)
q = pyes.MatchAllQuery()
s = conn.search(q,type='json-syslog',search_type='scan',scroll='8h',size=1000)
s.next()
```

returns something like
```
{
u'foo': u'bar',
'meta': {
u'index': u'logstash-v2-2011.12.01',
'parent': None,
'connection': ,
u'score': 0.0,
u'type': u'json-syslog',
u'id': u's9YVwUnWQNKEBHiVQm8HLw'
}
}
```

instead of something like:
```
{
u'_source':{
u'foo': u'bar',
}
'meta': {
u'index': u'logstash-v2-2011.12.01',
'parent': None,
'connection': ,
u'score': 0.0,
u'type': u'json-syslog',
u'id': u's9YVwUnWQNKEBHiVQm8HLw'
}
}
```

or:
```
{
u'_source':{
u'foo': u'bar',
}
u'index': u'logstash-v2-2011.12.01',
'parent': None,
'connection': ,
u'score': 0.0,
u'type': u'json-syslog',
u'id': u's9YVwUnWQNKEBHiVQm8HLw'
}
```