Created
September 27, 2010 20:31
-
-
Save kimchy/599771 to your computer and use it in GitHub Desktop.
This file contains 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 class TestMe { | |
public static void main(String[] args) throws Exception { | |
NodeBuilder nb = NodeBuilder.nodeBuilder().client(true); | |
Node node = nb.node(); | |
Client client = node.client(); | |
XContentBuilder content = XContentFactory.smileBuilder().startObject(); | |
content.field("indexid", "index21"); | |
content.field("documentkey", "532-UMSACT0420100927111149CMCSA-20100927111149"); | |
content.field("subtransid", "3072773936"); | |
content.field("dmsourceid", "index21"); | |
content.field("documentdate", "index21"); | |
content.field("documenttag", "WSMarketCommentary_15884843"); | |
content.field("documenttype", "MarketCommentary"); | |
content.field("feedid", "532"); | |
content.field("versiontag", "20100927111516"); | |
content.field("bridgesymbols", ""); | |
content.field("headline", "S&P Market Commentary"); | |
content.field("productcategory", "MarketCommentary"); | |
content.field("publicationdatetime", "2010-09-27 11:15:16.000"); | |
content.field("source", "SNPMarketScope"); | |
content.field("teaser", ""); | |
content.field("wsodcompany", ""); | |
content.field("wsodissue", ""); | |
content.endObject(); | |
client.prepareIndex("rebuild_index21", "index21", "532-UMSACT0420100927111149CMCSA-20100927111149") | |
.setSource(content).setOperationThreaded(false).execute() | |
.actionGet(); | |
client.admin().indices().prepareRefresh().execute().actionGet(); | |
SearchResponse response = client.prepareSearch().setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(); | |
for (SearchHit hit : response.hits()) { | |
System.out.println("" + hit.sourceAsMap()); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment