Not able to make elasticsearch work on our website

We are trying to set elasticsearch on our website but we are probably missing something in the configs that is preventing it to function on the website even though when we run:

curl -XGET "http://localhost:9200/

We get the output indicating that it is working fine.

ES_HEAP_SIZE is also set correctly as half of our server's memory

elasticsearch.yml file is as below:

# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
#       Before you set out to tweak and tune the configuration, make sure you
#       understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
# cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
# node.name: node-1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 127.0.0.1
#
# network.bind_host: localhost
# network.publish_host: localhost
#
# Set a custom port for HTTP:
#
http.port: 9200
# 
# script.disable_dynamic: true
# 
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
# 
# ----------expose elasticsearch APIs over HTTP-------------Umid------
# 
# http.cors.enabled: true
# http.cors.allow-origin: /.*/
# http.cors.allow-credentials: true
# 
# ---------------------------------- Gateway -----------------------------------
# 
# Block initial recovery after a full cluster restart until N nodes are started:
# 
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# --------------------------------- Discovery ----------------------------------
#
# Elasticsearch nodes will find each other via unicast, by default.
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: t

What are we missing here? Something with IP mismatch? Do we need to use our website's IP? Isn't the insecure? Thanks

EDIT:

elasticsearch.php content:

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['es_server'] = '192.168.1.1:9200';
$config['index'] = 'website';
?>

Since you're not saying much about the symptoms (an error message from the web site backend would help) it's hard to guess, but

network.host: 127.0.0.1

looks suspicious. Is the backend really running on the same host as ES?

Hi, thanks for your quick reply, I wasn't sure what to post to be helpful I am willing to provide any necessary information to debug this.

On the website when inspecting console it shows: 500 (Internal Server Error)

Our server is on DigitalOcean (Ubuntu 15.10) and we have installed ES on the server. So it is not on our local actually

On the website when inspecting console it shows: 500 (Internal Server Error)

Client-side error messages are typically not useful. Read the server log.

Our server is on DigitalOcean (Ubuntu 15.10) and we have installed ES on the server. So it is not on our local actually

This is contradictory. Are you running ES and the web backend on the same server?

Here are last logs in elasticsearch.log

[2016-01-18 06:48:59,809][INFO ][node                     ] [Donald Ritter] version[2.1.1], pid[12152], build[40e2c53/2015-12-15T13:05:55Z]
[2016-01-18 06:48:59,809][INFO ][node                     ] [Donald Ritter] initializing ...
[2016-01-18 06:48:59,957][INFO ][plugins                  ] [Donald Ritter] loaded [], sites [kopf]
[2016-01-18 06:48:59,985][INFO ][env                      ] [Donald Ritter] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [46.3gb], net total_space [58.9gb], spins? [possibly], types [ext4]
[2016-01-18 06:49:01,998][INFO ][node                     ] [Donald Ritter] initialized
[2016-01-18 06:49:01,999][INFO ][node                     ] [Donald Ritter] starting ...
[2016-01-18 06:49:02,076][INFO ][transport                ] [Donald Ritter] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2016-01-18 06:49:02,086][INFO ][discovery                ] [Donald Ritter] elasticsearch/Yasdflkj1UDKJl-pV8hgw
[2016-01-18 06:49:05,128][INFO ][cluster.service          ] [Donald Ritter] new_master {Donald Ritter}{Ybzg1oPvREeMObz-pV8hgw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-01-18 06:49:05,150][INFO ][http                     ] [Donald Ritter] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2016-01-18 06:49:05,150][INFO ][node                     ] [Donald Ritter] started
[2016-01-18 06:49:05,320][INFO ][gateway                  ] [Donald Ritter] recovered [1] indices into cluster_state
#tail -f /var/log/elasticsearch/elasticsearch.log
[2016-01-18 06:48:59,957][INFO ][plugins                  ] [Donald Ritter] loaded [], sites [kopf]
[2016-01-18 06:48:59,985][INFO ][env                      ] [Donald Ritter] using [1] data paths, mounts [[/ (/dev/vda1)]], net usable_space [46.3gb], net total_space [58.9gb], spins? [possibly], types [ext4]
[2016-01-18 06:49:01,998][INFO ][node                     ] [Donald Ritter] initialized
[2016-01-18 06:49:01,999][INFO ][node                     ] [Donald Ritter] starting ...
[2016-01-18 06:49:02,076][INFO ][transport                ] [Donald Ritter] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
[2016-01-18 06:49:02,086][INFO ][discovery                ] [Donald Ritter] elasticsearch/Ybzg1oPvREeMObz-pV8hgw
[2016-01-18 06:49:05,128][INFO ][cluster.service          ] [Donald Ritter] new_master {Donald Ritter}{Ybzg1oPvREeMObz-pV8hgw}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-join(elected_as_master, [0] joins received)
[2016-01-18 06:49:05,150][INFO ][http                     ] [Donald Ritter] publish_address {127.0.0.1:9200}, bound_addresses {127.0.0.1:9200}
[2016-01-18 06:49:05,150][INFO ][node                     ] [Donald Ritter] started
[2016-01-18 06:49:05,320][INFO ][gateway                  ] [Donald Ritter] recovered [1] indices into cluster_state

This is contradictory. Are you running ES and the web backend on the same server?

I'm not sure if I understood what you exactly mean. But our website is on DigitalOcean and we use PHP and Codeigniter to create json files of the content on the website for ES to read when doing a search.

Any help please?

It appears elasticsearch is working, but your client cannot connect to it.
As Magnus already commented, your network.host setting might be incorrect.
Can you connect via curl?