elasticsearchelasticsearch-jdbc-river

How can I set index_settings for Elasticsearch in elasticsearch-jdbc-river?


I'm trying to configure the index settings using elasticsearch-jdbc-river.

So far this is what I do :

curl -XPUT localhost:9200/_river/my_river/_meta?pretty=true --data @index.json

and this is my json file :

{
"type":"jdbc",
"jdbc":{
  "strategy":"simple",
  "poll":"5s",
  "scale":0,
  "autocommit":false,
  "fetchsize":10,
  "max_rows":0,
  "max_retries":3,
  "max_retries_wait":"10s",
  "driver":"com.mysql.jdbc.Driver",
  "url":"jdbc:mysql://mysql-server:3306/products_fr",
  "user":"root",
  "password":"root",
  "sql":"* from OFFERS"
},
"index":{
  "index":"dev",
  "type":"offers",
  "bulk_size":30,
  "max_bulk_requests":100,
  "index_settings":{
     "number_of_shards":10,
     "number_of_replicas":1,
     "analysis":{
        "analyzer":{
           "indexAnalyzer":{
              "type":"custom",
              "tokenizer":"standard",
              "filter":[
                 "lowercase",
                 "mySnowball"
              ]
           },
           "searchAnalyzer":{
              "type":"custom",
              "tokenizer":"standard",
              "filter":[
                 "standard",
                 "lowercase",
                 "mySnowball"
              ]
           }
        },
        "filter":{
           "mySnowball":{
              "type":"snowball",
              "language":"French"
           }
        }
     },
     "similarity":{
        "index":{
           "type":"BM25"
        },
        "search":{
           "type":"BM25"
        }
     },
     "type_mapping":null,
     "versioning":false,
     "acknowledge":false
  }
 }
}

The command works but it doesn't seem to be building the index. I've tried to build it before without the index_settings and restarting the elasticsearch server, it seems to build fine.

Can anyone help me understand what went wrong?


Solution

  • I have solved my problem by creating my index beforehand with the settings and then adding the river.

    At this point the index_settings in the river will be ignored since the index has already been created.

    Then I restarted Elasticsearch.

    PS: Not tested with Elasticsearch 2.x. +