ES - Create Index with jdbc, snowball analyer and mapping [what is wrong with my query?]


(Dom Sie) #1

Hey :slight_smile:

Please help me. I make this query to create an ES Index:

  curl -XPUT 'localhost:9200/_river/future_image/_meta' -d '{
    "type" : "jdbc",
    "jdbc" : {
        "url" : "jdbc:mysql://localhost:3306/xxx",
        "user" : "xxxx",
        "password" : "xxx",
        "sql" : "select * from 0_fotos"
    },
		
 "settings": {
    "analysis" : {
			  "filter" : {
				 "germansnow" : {
					"language" : "German2",
					"type" : "snowball"
				 }
			  },
			  "analyzer" : {
				 "german" : {
					"filter" : [
					   "germansnow",
					   "icu_folding"
					],
					"type" : "custom",
					"tokenizer" : "icu_tokenizer"
				 },
				 "default" : {
					"sub_analyzers" : [
					   "standard",
					   "german"
					],
					"type" : "combo"
				 }
			  }
		   },
		   "mappings": {
			  "jdbc": {
				 "properties": {
					"create_date": {
					   "type": "date",
					   "format": "dd.MM.yyyy"
					}
				 }
			  }
		   } 
  }
}'

What is wrong with the syntax? There is no error when i am execute this query at bash; but my new index have no mapping for the field create_date with the specific format and no analyzer :-/

Thx


(David Pilato) #2

Rivers have been removed. Don't use that.

Use the JDBC importer instead: https://github.com/jprante/elasticsearch-jdbc

Also, create your index first with the create index API: https://www.elastic.co/guide/en/elasticsearch/reference/2.2/indices-create-index.html


(Dom Sie) #3

Hi,

thx for your fast answer.
I must use rivers for this project because of strange reasons:/
Okay; i am first create the index first with the create index api and then put the analyzers and mappings to the index?
Is the syntax correct?

  curl -XPUT 'localhost:9200/_river/future_image/_meta' -d '{
     "settings": {
        "analysis" : {
    			  "filter" : {
    				 "germansnow" : {
    					"language" : "German2",
    					"type" : "snowball"
    				 }
    			  },
    			  "analyzer" : {
    				 "german" : {
    					"filter" : [
    					   "germansnow",
    					   "icu_folding"
    					],
    					"type" : "custom",
    					"tokenizer" : "icu_tokenizer"
    				 },
    				 "default" : {
    					"sub_analyzers" : [
    					   "standard",
    					   "german"
    					],
    					"type" : "combo"
    				 }
    			  }
    		   },
    		   "mappings": {
    			  "jdbc": {
    				 "properties": {
    					"create_date": {
    					   "type": "date",
    					   "format": "dd.MM.yyyy"
    					}
    				 }
    			  }
    		   } 
      }
    }'

(David Pilato) #4

No. You need to create settings for the target index which means the index where the river will send the data to.


(Jรถrg Prante) #5

Can you please elaborate? The details might be very important for all of us who have the challenge how to integrate external data importers with Elasticsearch, we want to develop the best of possible solutions.

The syntax is not correct, you can not create an index with _river endpoint. Beside that, there is no _river endpoint any more, unless you use very old Elasticsearch versions, which is not recommended (and not supported)


(system) #6