elasticsearch jdbc type mapping

584 views Asked by At

i'm trying to populate my elasticsearch index starting from mysql query. I am working on Windows and my batch is something like this:

echo {^
    "type" : "jdbc",^
    "jdbc" : {^
        "url" : "jdbc:mysql://localhost:3306/ade_ver",^
        "user" : "...",^
        "password" : "...",^
        "sql" :  select ... ",^
        "index" : "ade_ver",^
        "type" : "my_type",^
        "type_mapping": "{\"my_type\":{\"properties\":{\"prop1\":{\"type\":\"string\"},\"prop2\":{\"type\":\"string\"},**\"prop3\":{\"type\":\"string\",\"index\":\"not_analyzed\"}**, ecc.. }}}",^
        "elasticsearch" : {^
             "cluster" : "elasticsearch",^
             "host" : "localhost",^
             "port" : 9300^
        }^
      }^
} | "%JAVA_HOME%\bin\java" ecc..

now, everything works fine, my index is populated with expected data. The problem is that every field is set as "analyzed", even if i'm trying to set some of them as not analyzed. Where i am wrong?

1

There are 1 answers

0
Danilo On

I solved the issue creating the index and the mapping beforehand, and then used elasticsearch-jdbc to import data from mysql