janarthanam
janarthanam

Reputation: 41

how to map hive to elastic search _id field

I want to map hive key value to elastic search _id field.

Example:

CREATE EXTERNAL TABLE test (id BIGINT ,name string,dept string) 
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler' TBLPROPERTIES('es.resource' = 'hive/test','es.id.field' = 'id');

while am inserting record and checking elastic search it show below

{
    "_index": "hive",
    "_type": "extest",
    "_id": "AU6qODiDNN1Z0nJPsoXP",
    "_score": 1,
    "_source": {
        "id": 1,
        "name": "alex",
        "dept": "bigdata"
    }

"id": 1 and "_id": "AU6qODiDNN1Z0nJPsoXP" both are not sync up. I want to sync up both the values.

Upvotes: 2

Views: 691

Answers (1)

Ana Todor
Ana Todor

Reputation: 801

Try using the es.mapping.id property instead of your es.id.field.

See this link for more details:

https://www.elastic.co/guide/en/elasticsearch/hadoop/current/configuration.html#cfg-mapping

Upvotes: 2

Related Questions