Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Elastic Search query JSON response compression

How can we compress JSON response of a search request? I have tried following setting, but it didn't seem to work. http.compression = true

Request Header has following information.

Accept:"application/json, text/plain,/"

Accept-Language:"en-US,en;q=0.5"

Accept-Encoding:"gzip, deflate"

Content-Type:"application/json;charset=utf-8"

like image 312
Kuldeep Gupta Avatar asked Aug 13 '15 11:08

Kuldeep Gupta


People also ask

Can JSON response be compressed?

As text data, JSON data compresses nicely. That's why gzip is our first option to reduce the JSON data size. Moreover, it can be automatically applied in HTTP, the common protocol for sending and receiving JSON.

Does Elasticsearch have a UI?

Interoperable. Search UI can be used with any search service, and includes prebuilt connectors for Elasticsearch.


1 Answers

You can check if http compression is enabled by performing a simple curl GET request like this:

curl -H 'Accept-Encoding: gzip,deflate' -D - http://localhost:9200

If compression is enabled you will see the header Content-Encoding: gzip and the response will look compressed (random weird characters).

If compression is NOT enabled, you'll see the normal ES info response, something like this:

{
  "status" : 200,
  "name" : "Steven Lang",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.7.0",
    "build_hash" : "929b9739cae115e73c346cb5f9a6f24ba735a743",
    "build_timestamp" : "2015-07-16T14:31:07Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}
like image 55
Or Weinberger Avatar answered Oct 11 '22 03:10

Or Weinberger