0

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?

Danilo
  • 11
  • 1
  • try my old post http://stackoverflow.com/questions/27063028/elasticsearch-object-mapping-and-getting-data-from-database – AlainIb Jan 27 '16 at 09:13
  • i do it in two step, the mapping then the jdbc. it worked for me. – AlainIb Jan 27 '16 at 09:13
  • or this post too http://stackoverflow.com/questions/26486037/elasticsearch-mapping-tokenizer-keyword-to-avoid-splitting-tokens-and-enable-use – AlainIb Jan 27 '16 at 09:15
  • yep, thanks for the tip. I created the index with mapping, and then used jdbc. It worked just fine – Danilo Jan 27 '16 at 15:42

1 Answers1

1

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

Danilo
  • 11
  • 1