Hi
I am using java code to set mapping.
Is there any way to check the mapping i am using is applied or not
because even in invalid mapping setting i don't get any exception. I
want to make it sure that mapping is applied.
Mapping :
{
"index" : {
"analysis" : {
"analyzer" : {
"index_analyzer" : {
"type":"custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "customstopword"]
},
"search_analyzer" : {
"type":"custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "customstopword"]
}
},
"filter" : {
"customstopword": {
"type" : "stop",
"stopwords_path" :"c:/stopwordeng.txt" ,
"ignore_case":true
}
}
}
}
}
Used java code putting Mapping:
//creating index
CreateIndexResponse createindexresponseactionGet =
client.admin().indices().create(new
CreateIndexRequest(indexName)).actionGet();
logger.info("createindexresponseactionGet::"+createindexresponseactionGet);
//putting mapping
PutMappingResponse actionGet =
client.admin().indices().preparePutMapping(indexName).setType(indexType).setSource(mappingsource).execute().actionGet();
boolean acknowledged = actionGet.getAcknowledged();
logger.info("put mapping
acknowledged::"+acknowledged);
Thanks
kimchy
(Shay Banon)
January 19, 2012, 6:31pm
2
You can get the mapping back using the cluster state API. Here is how the
REST get mapping endpoint uses it:
https://github.com/elasticsearch/elasticsearch/blob/master/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java#L66
.
On Thu, Jan 19, 2012 at 1:59 PM, shammi mishra mishrashammi44@gmail.com wrote:
Hi
I am using java code to set mapping.
Is there any way to check the mapping i am using is applied or not
because even in invalid mapping setting i don't get any exception. I
want to make it sure that mapping is applied.
Mapping :
{
"index" : {
"analysis" : {
"analyzer" : {
"index_analyzer" : {
"type":"custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "customstopword"]
},
"search_analyzer" : {
"type":"custom",
"tokenizer" : "whitespace",
"filter" : ["lowercase", "customstopword"]
}
},
"filter" : {
"customstopword": {
"type" : "stop",
"stopwords_path" :"c:/stopwordeng.txt" ,
"ignore_case":true
}
}
}
}
}
Used java code putting Mapping:
//creating index
CreateIndexResponse createindexresponseactionGet =
client.admin().indices().create(new
CreateIndexRequest(indexName)).actionGet();
logger.info
("createindexresponseactionGet::"+createindexresponseactionGet);
//putting mapping
PutMappingResponse actionGet =
client.admin().indices().preparePutMapping(indexName).setType(indexType).setSource(mappingsource).execute().actionGet();
boolean acknowledged = actionGet.getAcknowledged();
logger.info("put mapping
acknowledged::"+acknowledged);
Thanks