Source:
public void setup() throws InterruptedException, ExecutionException, IOException { XContentBuilder mapping = jsonBuilder().startObject(); mapping.startObject("test").startObject("properties"); mapping.startObject("findme"); { mapping.field("type", "string"); mapping.field("analyzer", "custom"); } mapping.endObject(); XContentBuilder settings = jsonBuilder().startObject().startObject("index"); settings.startObject("analysis"); settings.startObject("analyzer"); settings.startObject("custom"); { settings.field("type", "custom"); settings.field("tokenizer", "standard"); settings.field("filter", new String[] {"standard", "capture_A", "lowercase"}); settings.field("char_filter", new String[] {"dots"}); } settings.endObject(); settings.endObject(); settings.startObject("filter"); settings.startObject("capture_A"); { settings.field("type", "pattern_capture"); settings.startArray("patterns").value("(A)").endArray(); } settings.endObject(); settings.endObject(); settings.startObject("char_filter"); settings.startObject("dots"); { settings.field("type", "mapping"); settings.field("mappings", new String[] {".=>\\u0020" }); } settings.endObject(); settings.endObject(); settings.endObject(); settings.endObject(); assertAcked(prepareCreate("test").setSettings(settings).addMapping("test", mapping)); ensureYellow(); indexRandom(true, client().prepareIndex("test", "test", "1").setSource("findme", "0 0 0 0 0 0", "otherfindme", "0"), client().prepareIndex("test", "test", "2").setSource("findme", "0 0 0 0"), client().prepareIndex("test", "test", "delimited1").setSource("findme", "CaptureAAAA Test"), client().prepareIndex("test", "test", "delimited2").setSource("findme", "CaptureAAA Test")); }

Target:
public void setup() throws InterruptedException, ExecutionException, IOException { XContentBuilder mapping = jsonBuilder().startObject(); mapping.startObject("test").startObject("properties"); mapping.startObject("findme"); { mapping.field("type", "string"); mapping.field("analyzer", "custom"); } mapping.endObject(); XContentBuilder settings = jsonBuilder().startObject().startObject("index"); settings.startObject("analysis"); settings.startObject("analyzer"); settings.startObject("custom"); { settings.field("type", "custom"); settings.field("tokenizer", "standard"); settings.field("filter", "standard", "capture_A", "lowercase"); settings.field("char_filter", new String[] {"dots"}); } settings.endObject(); settings.endObject(); settings.startObject("filter"); settings.startObject("capture_A"); { settings.field("type", "pattern_capture"); settings.startArray("patterns").value("(A)").endArray(); } settings.endObject(); settings.endObject(); settings.startObject("char_filter"); settings.startObject("dots"); { settings.field("type", "mapping"); settings.field("mappings", new String[] {".=>\\u0020" }); } settings.endObject(); settings.endObject(); settings.endObject(); settings.endObject(); assertAcked(prepareCreate("test").setSettings(settings).addMapping("test", mapping)); ensureYellow(); indexRandom(true, client().prepareIndex("test", "test", "1").setSource("findme", "0 0 0 0 0 0", "otherfindme", "0"), client().prepareIndex("test", "test", "2").setSource("findme", "0 0 0 0"), client().prepareIndex("test", "test", "delimited1").setSource("findme", "CaptureAAAA Test"), client().prepareIndex("test", "test", "delimited2").setSource("findme", "CaptureAAA Test")); }