Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined value returning var table = ES.Table(endpoint); #14

Open
KrishnaPG opened this issue Dec 19, 2014 · 6 comments
Open

Undefined value returning var table = ES.Table(endpoint); #14

KrishnaPG opened this issue Dec 19, 2014 · 6 comments

Comments

@KrishnaPG
Copy link
Contributor

Hello,

Trying to follow your example, but getting 'undefined value' error from ES.Table() function. You can try the below sample code and put a break point nere the 'problem here' statement and verify the problem.

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <!-- Bootstrap  CSS -->
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
        <link rel="stylesheet" href="http://cdn.datatables.net/1.10.4/css/jquery.dataTables.min.css">

    </head>
    <body>
        <h1>Hello World !!</h1>
        <div class="col-md-12">
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="mygrid"></table>
        </div>

        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
        <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.8.1/mustache.min.js"></script>   
        <script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="http://cdn.datatables.net/1.10.4/js/jquery.dataTables.js"></script> <!--jquery.dataTables.min.js-->
        <script type="text/javascript" src="http://okfnlabs.org/elasticsearch.js/elasticsearch.js"></script>

        <script type="text/javascript">     
    var endpoint = 'http://192.168.56.106:9200/tweets/tweet';

    var table = ES.Table(endpoint); // <-- PROBLEM HERE
        </script>
    </body>
</html>
@ghost
Copy link

ghost commented Oct 14, 2016

Hi, was there an answer to this question? I'm getting the same error. Thanks.

@rufuspollock
Copy link
Contributor

@ram-bcll-tech to patch we'd really want a failing test. Is there any way to see if you can get that?

@ghost
Copy link

ghost commented Oct 16, 2016

Thank you for your response. I'm new to ES and was trying to follow your tutorial. This may very well be a simple usage issue.

I do have the ES running on a server and I'm able to successfully query and get responses from the server on clients via HTTP.. However, when I try to embed the query in an app in a browser (Chrome Version 53.0.2785.143 (64-bit)), the code (attached) doesn't seem to go past the line, "var elasticsearch = require('elasticsearch');". I placed simple console.log messages immediately before and after this line. I see the preceding comment printed in the console, but, not the following one and there are no other messages, error or otherwise, in the console, so, I'm not able to figure out what the issue is. Thanks for any help you can provide.

App.prototype.getMinorsCount = function()
{
console.log("starting elasticsearch connection");
var elasticsearch = require('elasticsearch');
console.log("past elasticsearch declaration");

var client = new elasticsearch.Client({
  host: 'http://<server_name>.amazonaws.com:9200',
  log: 'trace'
});

client.ping({

requestTimeout: 30000,

  // undocumented params are appended to the query string
  hello: "elasticsearch"
}, function (error) {
  if (error) {
    console.error('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});

};

console output:

starting elasticsearch connection

@rufuspollock
Copy link
Contributor

@ram-bcll-tech got you. The thing is without some error output it is tough to debug. Do you see any error messages in the console?

@ghost
Copy link

ghost commented Oct 25, 2016

Sorry, i thought I had responded to your last note, but, i don't see it online.

To answer your last question, no, I don't see any error messages. This is what has me stumped as well.

@ghost
Copy link

ghost commented Oct 25, 2016

No, unfortunately the only message in the console is the console.log
message, immediately preceding "var elasticsearch =
require('elasticsearch');" line. The console.log message immediately
following the var line is not executed. I do know that nothing else in the
function gets executed either as there are other console.log messages in
the function that are not executed.

Thanks for your help.

Best regards,
Ram

Here's the entire function (stripped down for simplicity):

PTApp.prototype.getMinorsCount = function()
{
console.log("starting elasticsearch connection"); <== this is printed
var elasticsearch = require('elasticsearch');
console.log("past elasticsearch declaration"); <== this is NOT
printed

var client = new elasticsearch.Client({
  host: 'http://ec2-54-166-167-126.compute-1.amazonaws.com:9200',
  log: 'trace'
});

client.ping({
  requestTimeout: 30000,
  hello: 'elasticsearch'
}, function (error) {
  if (error) {
    console.error('elasticsearch cluster is down!');
  } else {
    console.log('All is well');
  }
});

console.log("leaving elasticsearch connection");
};

On Thu, Oct 20, 2016 at 8:56 AM, Rufus Pollock [email protected]
wrote:

@ram-bcll-tech https://github.com/ram-bcll-tech got you. The thing is
without some error output it is tough to debug. Do you see any error
messages in the console?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#14 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ARrhNAYfuB2w0iBmrIKVdLDsg73IK1JXks5q12T0gaJpZM4DKW-n
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants