Trying to reduce the storage used by elasticsearch2.2

curl: (6) Could not resolve host: xn--localhost-499d

It looks like Microsoft Office or similar quote-damaged your command. Make sure the quotes are plain ASCII straight quotes. Comparison between your command and what it should look like:

curl -XPUT ‘localhost:9200/twitter/_settings’ -d ‘{“index”: {“codec”: “best_compression”}}’
curl -XPUT 'localhost:9200/twitter/_settings' -d '{"index": {"codec": "best_compression"}}'