How to set the analyzer for a field when i usespark-elasticsearch saveToEsWithMeta save to es


(tonychan) #1

my question is how to set the analyzer for a field which's name is changed ,
my code like as below:

val test ="性别"
val lbs: Map[String, String] = Map("create_time" -> "1491990010000",
"name" -> "年龄",
"values" -> "70后,80后,90后",
"label" -> "{values}",
"measure" ->"0.0",
"tags" ->"用户画像,灰度发布",
test->"性别,男")
sc.makeRDD(Seq((1, lbs))).saveToEsWithMeta("label_sys_label/label")

my version is 2.4.0
3q for help!!


(James Baiera) #2

Repeating the response from github on this question:

If you are adding new fields to an index or creating new indices in Elasticsearch from ES-Hadoop you may need to set some sort of index template so that when the new index is created it has the correct mappings and analyzers that you would expect.


(tonychan) #3

i dont konw the field in advance,so i cant set at the template ,any way to set at the code

发自网易邮箱大师
在2017年05月07日 03:09,James Baiera 写道:
|
| | james.baieraJames Baiera
May 6 |
|
|

Repeating the response from github on this question:

If you are adding new fields to an index or creating new indices in Elasticsearch from ES-Hadoop you may need to set some sort of index template so that when the new index is created it has the correct mappings and analyzers that you would expect.

|

Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.


(James Baiera) #4

Unfortunately there is no way to set the mapping from the ES-Hadoop side of things at this time.


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.