elasticsearch mysql revier
curl -XPOST http://127.0.0.1:9002/news/_close
curl -XPUT http://127.0.0.1:9002/news/_settings -d'
{
"index" : {
"analysis" : {
"analyzer" : {
"pinyin_analyzer" : {
"tokenizer" : "my_pinyin",
"filter" : ["standard"]
}
},
"tokenizer" : {
"my_pinyin" : {
"type" : "pinyin",
"first_letter" : "append",
"padding_char" : " "
}
}
}
}
}'
curl -XPOST http://127.0.0.1:9002/news/ms_ecms_article/_mapping -d'
{
"ms_ecms_article": {
"properties": {
"keyboard": {
"type": "multi_field",
"fields": {
"keyboard": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "ik",
"searchAnalyzer": "ik"
},
"keyboard_en": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "pinyin_analyzer",
"searchAnalyzer": "pinyin_analyzer"
}
}
},
"title": {
"type": "multi_field",
"fields": {
"title": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "ik",
"searchAnalyzer": "ik"
},
"title_en": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "pinyin_analyzer",
"searchAnalyzer": "pinyin_analyzer"
}
}
},
"ftitle": {
"type": "multi_field",
"fields": {
"ftitle": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "ik",
"searchAnalyzer": "ik"
},
"ftitle_en": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "pinyin_analyzer",
"searchAnalyzer": "pinyin_analyzer"
}
}
},
"smalltext": {
"type": "multi_field",
"fields": {
"smalltext": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "ik",
"searchAnalyzer": "ik"
},
"smalltext_en": {
"type": "string",
"store": "yes",
"index": "analyzed",
"indexAnalyzer": "pinyin_analyzer",
"searchAnalyzer": "pinyin_analyzer"
}
}
}
}
}
}'
curl -XPUT 'http://127.0.0.1:9002/_river/who_jdbc_river/_meta' -d '{
"type": "jdbc",
"jdbc": {
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://127.0.0.1:3306/news",
"user": "admin",
"password": "admin",
"sql": "select id as _id,keyboard,title,ftitle,smalltext from ecms_article",
"index": "news",
"type": "ms_ecms_article",
"bulk_size": 100,
"max_bulk_requests": 30,
"bulk_timeout": "10s",
"flush_interval": "5s",
"schedule": "0 0-59 0-23 ? * *"
}
}'
curl -XDELETE '127.0.0.1:8379/_river/who_jdbc_river'
curl -XPUT 'http://127.0.0.1:8379/_river/who_jdbc_river/_meta' -d '{
"type": "jdbc",
"jdbc": {
"driver": "com.mysql.jdbc.Driver",
"url": "jdbc:mysql://localhost:3306/profile",
"user": "admin",
"password": "admin",
"sql": [
{
"statement": "select id as _id,name,login_name from user where mytimestamp > UNIX_TIMESTAMP(?)",
"parameter": [
"$river.state.last_active_begin"
]
}
],
"index": "profile",
"type": "user",
"bulk_size": 100,
"max_bulk_requests": 30,
"bulk_timeout": "10s",
"flush_interval": "5s",
"schedule": "0 0-59 0-23 ? * *"
}
}'
http://xbib.org/repository/org/xbib/elasticsearch/plugin/elasticsearch-river-jdbc/2.1.0.0/elasticsearch-river-jdbc-2.1.0.0-plugin.zip
http://xbib.org/repository/org/xbib/elasticsearch/importer/elasticsearch-jdbc/2.1.0.0/elasticsearch-jdbc-2.1.0.0-dist.zip