question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import from mysql doesn't create index

See original GitHub issue

Hi,

I’m running following script in order to synchronyse artists table from mysql with artists index in elasticsearch but, after execution nothing appears in index as well as index itself: `` `bin=/root/elasticsearch-jdbc-2.2.0.1/bin lib=/root/elasticsearch-jdbc-2.2.0.1/lib

echo ‘{ “type” : “jdbc”, “jdbc” : { “url” : “jdbc:mysql://localhost:3306/databasename”, “user” : “user”, “password” : “Password”, “sql” : “select artistid as _id, artist_name, link, short_artist_name from artists”, “index” : “artists”, “type” : “artist” } }’ | java
-cp “${lib}/*”
-Dlog4j.configurationFile=${bin}/log4j2.xml
org.xbib.tools.Runner
org.xbib.tools.JDBCImporter`

curl ‘http://localhost:9200/_cat/indices?v’ returns health status index pri rep docs.count docs.deleted store.size pri.store.size

Please advise what do I do wrong?

Configuration: elasticsearch-jdbc-2.2.0.1 java version “1.8.0_77” elasticsearch 2.3.0 Java™ SE Runtime Environment (build 1.8.0_77-b03) Java HotSpot™ 64-Bit Server VM (build 25.77-b03, mixed mode) mysql Ver 14.14 Distrib 5.6.28, for debian-linux-gnu (x86_64) using EditLine wrapper

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dengshilongcommented, Apr 3, 2016

You can add cluster name like this

{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://localhost:3306/blog",
        "statefile" : "statefile.json",
        "schedule" : "0 0-59 0-23 ? * *",
        "user" : "blog",
        "password" : "12345678",
        "sql" : [{
                "statement": "select id as _id, post_title as title, post_content as content from wp_posts where post_status = ? and post_modified > ? ",
                "parameter": ["publish", "$metrics.lastexecutionstart"]}
            ],
        "index" : "customer",
        "type" : "blog",
        "metrics": {
            "enabled" : true
        },
        "elasticsearch" : {
             "cluster" : "elasticsearch",
             "host" : "localhost",
             "port" : 9300 
        }   
    }
}
0reactions
dengshilongcommented, Apr 19, 2016

The content for “post_status = ? and post_modified > ?” is from “parameter”: [“publish”, “$metrics.lastexecutionstart”]}, just run my_scripts.sh is enough.

Read more comments on GitHub >

github_iconTop Results From Across the Web

After importing sql files indexes in place, but not actually indexed
I imported all of our database to a new server. When I looked at the tables I see the indexes, but they all...
Read more >
13.1.15 CREATE INDEX Statement - MySQL :: Developer Zone
Normally, you create all indexes on a table at the time the table itself is created with CREATE TABLE . See Section 13.1.20,...
Read more >
mysqldump doesn't create tables or import any data
You want to run the dump through the mysql client. Example: mysql -uroot -p testimport < database.dump.
Read more >
MySQL Import Error: The used table type doesn't support ...
MySQL Import Error: The used table type doesn't support FULLTEXT indexes · Open your . · Run a 'find' for all occurrences of...
Read more >
MySQL Index Creation Internals
Create the table structure first, then import the data and add indexes later. Create the table structure with indexes and then import the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found