# Garbage results when using the elasticsearch\_dsl client on Google App Engine

**URL:** <https://discuss.elastic.co/t/garbage-results-when-using-the-elasticsearch-dsl-client-on-google-app-engine/75932>\
**Category:** Elasticsearch\
**Created:** [February 21, 2017, 5:29pm UTC](https://discuss.elastic.co/t/garbage-results-when-using-the-elasticsearch-dsl-client-on-google-app-engine/75932 "2017-02-21T17:29:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hgrimberg\_sr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hgrimberg_sr/32/15749_2.png) [@hgrimberg\_sr](https://discuss.elastic.co/u/hgrimberg_sr)\
**Post date:** [February 21, 2017, 5:29pm UTC](https://discuss.elastic.co/t/garbage-results-when-using-the-elasticsearch-dsl-client-on-google-app-engine/75932/1 "2017-02-21T17:29:33Z")

</div>

I've discovered an interesting problem when searching using the python Elasticsearch DSL client on Google AppEngine.

Google AppEngine does not work with urllib3 and instead uses a patched version of requests that proxies to an internal request API. I can index data just fine using the `RequestsHttpConnection` connection class.

However, whenever I perform a search, I get garbage results (in that the results make no sense). I used the output of `my_search_request.to_dict()` through cURL and got the expected result. Upon further investigation, I noticed that Google App Engine strips the `Content-Length:` header on the request as a security precaution. When I attempted the same query through cURL only without the `Content-Length` header I get the same bad result.

To confirm, I setup a reverse proxy in front of my local ElasticSearch instance and and set the connection in my code to point to it. Sure enough, the user agent was rewritten by Google and there was no Content-Length header.

Are there any known workarounds that can be done from the client (like send an additional parameter)? Google does offer a native socket interface that is in Beta, but I would prefer to use the standard HTTP fetch api that google provides.

EDIT: It looks like URLFetch in AppEngine does weird stuff with Content-Length when a GET request has a body.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 21, 2017, 5:29pm UTC](https://discuss.elastic.co/t/garbage-results-when-using-the-elasticsearch-dsl-client-on-google-app-engine/75932/2 "2017-03-21T17:29:36Z")

</div>

Closed on March 21, 2017, 5:29pm UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
