Hi,
I am trying to move data from SQL Server to ElasticSearch. I am using the JDBC importer (http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.3.4.1/) and have written a batch script to pull the data.
My initial steps were to install java and elasticsearch and confirm it was running
I then extracted the JDBC importer to the elasticsearch\bin folder
I then downloaded the SQL Server drivers and placed them in the Importer Plugin Lib folder
I then created the following script
@echo off
set DIR=%~dp0
set LIB=%DIR%..\lib*
set BIN=%DIR%..\bin
REM ???
echo '
{
"type" : "jdbc",
"jdbc" : {
"url" : "jdbc:sqlserver://localhost:;instanceName=<instance_name>;databaseName=<db_name>",
"user" : "",
"password" : "",
"sql" : "<select_statement>",
"treat_binary_as_string" : true,
"elasticsearch" : {
"cluster" : "elasticsearch",
"host" : "localhost",
"port" : 9200
},
"index" :"record",
"type" :"record"
}
}
' | "%JAVA_HOME%\bin\java" -cp "%LIB%" -Dlog4j.configurationFile="%BIN%\log4j2.xml" "org.xbib.tools.Runner" "org.xbib.tools.JDBCImporter"
placed it in the Importer Plugin bin folder and ran the script. But I am getting the following error
C:\elasticsearch-2.4.1\bin\elasticsearch-jdbc-2.3.4.1\bin>mssql-simple-example.bat
'
'{' is not recognized as an internal or external command,
operable program or batch file.
'"type"' is not recognized as an internal or external command,
operable program or batch file.
'"jdbc"' is not recognized as an internal or external command,
operable program or batch file.
'"url"' is not recognized as an internal or external command,
operable program or batch file.
'"user"' is not recognized as an internal or external command,
operable program or batch file.
'"password"' is not recognized as an internal or external command,
operable program or batch file.
'"sql"' is not recognized as an internal or external command,
operable program or batch file.
'"treat_binary_as_string"' is not recognized as an internal or external command,
operable program or batch file.
'"elasticsearch"' is not recognized as an internal or external command,
operable program or batch file.
'"cluster"' is not recognized as an internal or external command,
operable program or batch file.
'"host"' is not recognized as an internal or external command,
operable program or batch file.
'"port"' is not recognized as an internal or external command,
operable program or batch file.
'}' is not recognized as an internal or external command,
operable program or batch file.
'"index"' is not recognized as an internal or external command,
operable program or batch file.
'"type"' is not recognized as an internal or external command,
operable program or batch file.
'}' is not recognized as an internal or external command,
operable program or batch file.
'}' is not recognized as an internal or external command,
operable program or batch file.
''' is not recognized as an internal or external command,
operable program or batch file.
I am new to ES so advise would be greatly appreciated.
Thanks,