Created
July 19, 2010 17:55
-
-
Save kimchy/481733 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void main(String[] args) { | |
List<Node> nodes = new ArrayList<Node>(); | |
for (int i = 0; i < 4; i++) { | |
nodes.add(NodeBuilder.nodeBuilder().node()); | |
} | |
Node client = NodeBuilder.nodeBuilder().client(true).node(); | |
CreateIndexResponse createIndexResponse = client.client().admin().indices().prepareCreate("test").execute().actionGet(); | |
System.out.println("created index, ack = " + createIndexResponse.acknowledged()); | |
PutMappingResponse putMappingResponse = client.client().admin().indices().preparePutMapping("test").setType("sale") | |
.setSource("{\"sale\":{\"properties\":{\"salescode\":{\"type\":\"string\",\"boost\":1},\"sdate\":{\"type\":\"date\",\"boost\":1,\"format\":\"YYYY-MM-dd HH:mm:ss.S\"},\"orgid\":{\"type\":\"long\",\"boost\":1},\"safname\":{\"type\":\"string\",\"boost\":1},\"salname\":{\"type\":\"string\",\"index\":\"not_analyzed\",\"boost\":1},\"saemail\":{\"type\":\"string\",\"boost\":1},\"saaddr1\":{\"type\":\"string\",\"boost\":1},\"saaddr2\":{\"type\":\"string\",\"boost\":1},\"sacity\":{\"type\":\"string\",\"boost\":1},\"sastateprov\":{\"type\":\"string\",\"boost\":1},\"sapostalcode\":{\"type\":\"string\",\"boost\":1},\"sacountry\":{\"type\":\"string\",\"boost\":1},\"saphone\":{\"type\":\"string\",\"boost\":1},\"bafname\":{\"type\":\"string\",\"boost\":1},\"balname\":{\"type\":\"string\",\"boost\":1},\"baemail\":{\"type\":\"string\",\"boost\":1},\"baaddr1\":{\"type\":\"string\",\"boost\":1},\"baaddr2\":{\"type\":\"string\",\"boost\":1},\"bacity\":{\"type\":\"string\",\"boost\":1},\"bastateprov\":{\"type\":\"string\",\"boost\":1},\"bapostalcode\":{\"type\":\"string\",\"boost\":1},\"bacountry\":{\"type\":\"string\",\"boost\":1},\"baphone\":{\"type\":\"string\",\"boost\":1},\"creditcard\":{\"type\":\"string\",\"boost\":1},\"trxamount\":{\"type\":\"double\",\"boost\":1},\"trxdate\":{\"type\":\"date\",\"boost\":1,\"format\":\"YYYY-MM-dd HH:mm:ss.S\"},\"pgownertype\":{\"type\":\"integer\",\"boost\":1},\"pgownerid\":{\"type\":\"integer\",\"boost\":1}}}}") | |
.execute().actionGet(); | |
System.out.println("put mapping, ack = " + putMappingResponse.acknowledged()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment