How To Do Mapping While Indexing In Elasticsearch
I am using ElasticSearch in a website where i index data from MongoDB. def postToEs(self): ''' put data to the elasticsearch ''' es = Elasticsearch() cursor = s
Solution 1:
Delete the existing index
curl -XDELETE "http://hostname:9200/index/type"
Delete the existing river config index
curl -XDELETE "http://hostname:9200/_river"
Create mapping to index
curl -XPUT "http://hostname:9200/index/type/_mapping" -d'
{
"allnews": {
"properties": {
"category": {
"type": "string"
},
"description": {
"type": "string"
},
"link": {
"type": "string"
},
"state": {
"type": "string",
"index" : "not_analyzed"
},
"title": {
"type": "string"
}
}
}
}'
After these steps put the river plugin config sync mongodb to elasticsearch.
HOpe it helps..!
Post a Comment for "How To Do Mapping While Indexing In Elasticsearch"