You need to predefine the mapping using the put mapping API, and then
start indexing using river
//prepare mapping
XContentBuilder indexSettings = null;
XContentBuilder stopwordfilter = null;
stopwordfilter = XContentFactory.jsonBuilder();
stopwordfilter.startObject().startObject("stopwordfilter").field("type",
"stop").field("stopwords_path", "c:\resources
\stopwords_eng.txt").field("ignore_case", "true").endObject();
System.out.println(stopwordfilter.string());
indexSettings = XContentFactory.jsonBuilder();
indexSettings.startObject().startObject("index").startObject("analysis").startObject("analyzer").startObject("index_analyzer").field("type",
"custom").field("tokenizer", "whitespace").field("filter", new String
{"stopwordfilter"}) //.field("char_filter", new String
{"html_strip"})
.field("filter",
stopwordfilter).endObject().endObject().endObject().endObject().endObject();
System.out.println(indexSettings.string());
// putting mapping API
String[] indices1= new String[1];
indices1[0]=indexName;
PutMappingRequest putMappingRequest = new
PutMappingRequest(indexName);
PutMappingRequest source =
putMappingRequest.source(indexSettings).indices(indices1).type(indexType).ignoreConflicts(true);
PutMappingResponse actionGet1 =
client.admin().indices().putMapping(source).actionGet();
boolean acknowledged = actionGet1.getAcknowledged();
System.out.println(acknowledged);
On Jan 18, 2:28 pm, shammi mishra mishrashamm...@gmail.com wrote:
Hi
Is there is any way to override the default analyzer when creating
rabbitmq river, because rabbitmq river uses the bulk message format.
if it possible to please provide the mapping details.
also I have read following document,but i did not get how to send
mapping with bulk message format.
Index / Search Analyzershttp://www.elasticsearch.org/guide/reference/mapping/root-object-type...
Analyzerhttp://www.elasticsearch.org/guide/reference/index-modules/analysis/
Core Typeshttp://www.elasticsearch.org/guide/reference/mapping/core-types.html
please help me?