Skip to content

Instantly share code, notes, and snippets.

View sameek's full-sized avatar

sameek sameek

  • Arosys
  • India
View GitHub Profile
@sameek
sameek / HelloStructsExample.1.log
Created October 8, 2012 09:51
Generated log file using log4j.xml
2012-10-08 15:10:59 DEBUG XmlConfigurationProvider:68 - Loading action configurations from: struts-default.xml
2012-10-08 15:10:59 DEBUG DefaultFileManager:68 - Creating revision for URL: jar:file:/F:/Eclipse%20WorkSpace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/HelloStructsExample/WEB-INF/lib/struts2-core-2.3.4.1.jar!/struts-default.xml
2012-10-08 15:10:59 DEBUG XmlConfigurationProvider:68 - Loaded action configuration from: struts-default.xml
2012-10-08 15:10:59 INFO XmlConfigurationProvider:42 - Parsing configuration file [struts-default.xml]
2012-10-08 15:10:59 DEBUG XmlConfigurationProvider:68 - Loaded type: name:xwork impl:com.opensymphony.xwork2.ObjectFactory
2012-10-08 15:10:59 DEBUG XmlConfigurationProvider:68 - Loaded type:com.opensymphony.xwork2.ObjectFactory name:struts impl:org.apache.struts2.impl.StrutsObjectFactory
2012-10-08 15:10:59 DEBUG XmlConfigurationProvider:68 - Loaded type:com.opensymphony.xwork2.FileManager name:xwork impl:com.opensymphony.xwork2.util.fs.DefaultFi
@sameek
sameek / index.jsp
Created May 25, 2012 09:01
Ajax File
function setbrowser()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
@sameek
sameek / gist:2576109
Created May 2, 2012 12:03
DeleteIndexType
public boolean deleteIndexType(Client client, String indexName, String indexType) {
boolean deleteIndexTypeStatus = false;
boolean indexTypeExist = checkIndexTypeExistance.isIndexTypeExist(client, indexName, indexType);
logger.debug("index Type Existence found>>" + indexTypeExist);
if (indexTypeExist) {
DeleteMappingResponse actionGet = client.admin().indices().prepareDeleteMapping(indexName).setType(indexType).execute().actionGet();
RefreshRequestBuilder prepareRefresh = client.admin().indices().prepareRefresh(indexName);
RefreshResponse refreshActionGet = prepareRefresh.execute().actionGet();
@sameek
sameek / gist:2576048
Created May 2, 2012 11:51
DocumentAlreadyExistsEngineException
[2012-05-02 17:12:44,519][INFO ][cluster.metadata ] [Stegron] [[idx_masterdatabase]] remove_mapping [type_test8]
[2012-05-02 17:13:12,798][INFO ][cluster.metadata ] [Stegron] [idx_masterdatabase] create_mapping [type_test8]
[2012-05-02 17:13:12,814][DEBUG][action.bulk ] [Stegron] [idx_masterdatabase][4]: Failed to execute bulk item (index) [index {[idx_masterdatabase][type_test8][3], source[{ "type_test8" :{"id":3,"Description":"hello-world "}}]}]
org.elasticsearch.index.engine.DocumentAlreadyExistsEngineException: [idx_masterdatabase][4] [type_test8][3]: document already exists
at org.elasticsearch.index.engine.robin.RobinEngine.innerCreate(RobinEngine.java:349)
at org.elasticsearch.index.engine.robin.RobinEngine.create(RobinEngine.java:266)
at org.elasticsearch.index.shard.service.InternalIndexShard.create(InternalIndexShard.java:272)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:136)
at org.elasticsearch.act
@sameek
sameek / gist:2223253
Created March 28, 2012 03:12
VersionConflictEngineException
2012-03-26 16:09:11,696][INFO ][cluster.metadata ] [Test] [idx_testtable] update_mapping [test_type]
[2012-03-26 16:09:11,783][WARN ][river.rabbitmq ] [Test] [rabbitmq][river] failed to executefailure in bulk execution:
[0]: index [idx_testtable], type [test_type], id [1], message [VersionConflictEngineException[[idx_testtable][2] [test_type][1]: version conflict, current [-1], provided [1]]]
[1]: index [idx_testtable], type [test_type], id [2], message [VersionConflictEngineException[[idx_testtable][3] [test_type][2]: version conflict, current [-1], provided [1]]]
[2]: index [idx_testtable], type [test_type], id [3], message [VersionConflictEngineException[[idx_testtable][4] [test_type][3]: version conflict, current [-1], provided [1]]]
[3]: index [idx_testtable], type [test_type], id [4], message [VersionConflictEngineException[[idx_testtable][0] [test_type][4]: version conflict, current [-1], provided [1]
@sameek
sameek / gist:2223250
Created March 28, 2012 03:10
bulk message format
{ "create" : { "_index" :"idx_testtable", "_type" :"test_type", "_id" :"1","_version" :1}}
{ "test_type" :{"id":1,"Description":"A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations"}}
{ "create" : { "_index" :"idx_testtable", "_type" :"test_type", "_id" :"2","_version" :1}}
{ "test_type" :{"id":2,"Description":"The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem."}}
{ "create" : { "_index" :"idx_testtable", "_type" :"test_type", "_id" :"3","_version" :1}}
{ "test_type" :{"id":3,"Description":"hello-world"}}
@sameek
sameek / gist:2027994
Created March 13, 2012 10:16
elastic server log
[2012-03-13 13:53:32,399][DEBUG][action.bulk ] [sameek Test] [idx_masterdatabase][1] failed to bulk item (index) index {[idx_masterdatabase][type_testtable][0], source[{ "type_testtable" :{"id":1,"Description":"A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations"}}]}
java.lang.IllegalArgumentException: This AttributeSource contains AttributeImpl of type org.apache.lucene.analysis.tokenattributes.PayloadAttributeImpl that is not in the target
at org.apache.lucene.util.AttributeSource.copyTo(AttributeSource.java:529)
at org.apache.lucene.analysis.shingle.ShingleFilter.getNextToken(ShingleFilter.java:379)
at org.apache.lucene.analysis.shingle.ShingleFilter.shiftInputWindow(ShingleFilter.java:418)
at org.apache.lucene.analysis.shingle.ShingleFilter.incrementToken(ShingleFilter.java:284)
at org.elasticsearch.common.lucene.all.AllTokenStream.incrementToken(AllTokenStream.java:57)
at org.apache.lucene.index.DocInv
@sameek
sameek / gist:2027964
Created March 13, 2012 10:08
Custom Analyzer Setting
String analyzerSetting= " { \n" +
" \"index\" : {\n"+
"\"analysis\" : {\n"+
"\"analyzer\" : {\n"+
" \"mainindexanalyzer\" : {\n"+
"\"type\":\"custom\",\n"+
"\"tokenizer\" : \"whitespace\",\n"+
"\"filter\" : [\"lowercase\",\"asciifolding\",\"length\",\"mystopword\",\"mysynonym\",\"myworddelimiter\","\"myshingle\"],\n"+
"\"char_filter\" :[\"html_strip\"]\n"+
" },\n"+
@sameek
sameek / gist:1948665
Created March 1, 2012 10:02
Rabbitmq River Settings
"type" : "rabbitmq",
"rabbitmq" : {
"host" : "localhost",
"port" : 5672,
"user" : "guest",
"pass" : "guest",
"vhost" : "/",
"queue" : "myelasticsearch",
"exchange" : "myelasticsearch",
"routing_key" : "myelasticsearch",
@sameek
sameek / gist:1868365
Created February 20, 2012 08:07
correct approach to get fields value from an index
float boost = (float) 1.0;
int minimumNumberShouldMatch = 2;
BoolQueryBuilder boolquery = new BoolQueryBuilder();
QueryStringQueryBuilder customerqueryStringQueryBuilder = new QueryStringQueryBuilder(customerid).analyzer("mainsearchanalyzer");
QueryStringQueryBuilder accountqueryStringQueryBuilder = new QueryStringQueryBuilder(secondaryMachingData).analyzer("mainsearchanalyzer");
BoolQueryBuilder boolquery1 = boolquery.boost(boost).minimumNumberShouldMatch(minimumNumberShouldMatch).should(customerqueryStringQueryBuilder).should(accountqueryStringQueryBuilder);
SearchResponse searchResponse = client.prepareSearch(masterIndexName).setSearchType(SearchType.DEFAULT).setTypes(customerExceptionIndexName).setQuery(boolquery1).execute().actionGet();
logger.debug("searchResponse Object:: \n" + searchResponse);