Elasticsearch 5: Use provided constants for status codes
This commit replaces some magic numbers (HTTP status codes) with already-existing constants for this purpose.