Open guyajun opened 9 years ago
Hi Try this workaround: make a view on your SQL and query that view from the in the "sql"-parameter above.
TanQ so much @akobler. Solved my issue. I'm having 1 question. After indexing the data without affecting at the time of re-indexing I tried to use aliases but only thing is how can I know the previous alias and removing it and adding the new alias after re-indexing. All this has to happen with a scheduled job. Can u plz provide ur valuable suggestions.
!/bin/sh
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" bin=${DIR}/../bin lib=${DIR}/../lib
echo '{ "type" : "jdbc", "jdbc" : { "url" : "jdbc:postgresql://10.200.200.201:5432/cmdbuild", "user":"dbuser", "password":"123456", "sql":"select v.\"Code\" as _id,v.\"Code\" as \"ComputerName\" from \"VirtualServer\" v where v.\"Status\"='A' and v.\"DeviceStatus\"=990", "interval":"5s", "index_settings" : { "index" : { "number_of_shards" : 1, "number_of_replicas":1 } }, "index":"profiles", "type":"Server" } } ' | java \ -cp "${lib}/*" \ -Dlog4j.configurationFile=file://localhost/C:/elasticsearch-jdbc-1.6.0.0-dist/elasticsearch-jdbc-1.6.0.0/bin/log4j2.xml \ org.xbib.tools.Runner \ org.xbib.tools.JDBCImporter