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
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'esClient2' defined in class path resource [fr/pilato/spring/elasticsearch/xml/es-settings-test-context.xml]: Invocation of init method failed; nested exception is org.elasticsearch.indices.IndexMissingException: [twitter] missing | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) | |
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) | |
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) | |
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) | |
at org.springframework.beans.factory.support.Abstrac |
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
# Remove old data | |
curl -XDELETE "http://localhost:9200/french" | |
# Create index with settings | |
curl -XPOST "http://localhost:9200/french/" -d ' | |
{ | |
"settings":{ | |
"index":{ | |
"analysis":{ | |
"analyzer":{ |
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
{ | |
"took" : 3, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 3, | |
"failed" : 2, | |
"failures" : [ { | |
"index" : "dpitestcase", | |
"shard" : 3, |
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
curl -XPOST 'http://localhost:9200/spokely_development_users' -d '{"mappings":{"user":{"properties":{"id":{"index":"not_analyzed","type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"},"headline":{"type":"string"},"jobs":{"type":"object"},"educations":{"type":"object"},"skills":{"type":"string"},"linkedin_summary":{"type":"string"},"linkedin_groups":{"type":"string"},"linkedin_certifications":{"type":"string"},"fb_user_id":{"index":"not_analyzed","include_in_all":false,"type":"string"},"fb_connections":{"index":"not_analyzed","include_in_all":false,"type":"string"},"linkedin_id":{"index":"not_analyzed","include_in_all":false,"type":"string"},"linkedin_connections":{"index":"not_analyzed","include_in_all":false,"type":"string"},"is_active":{"type":"boolean","include_in_all":false},"is_email_confirmed":{"type":"boolean","include_in_all":false}}}},"settings":{}}' | |
curl -XPOST 'http://localhost:9200/spokely_development_users/user/3457' -d '{"fb_connections":[],"fb_user_id":"1314809","first_ |
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
curl -XDELETE 'http://localhost:9200/myindex' | |
curl -XPUT 'http://localhost:9200/myindex' | |
curl -XPUT 'http://localhost:9200/myindex/myindext/_mapping' -d '{ | |
"myindext": { | |
"properties": { | |
"user": { | |
"type": "string" | |
}, | |
"message": { |
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
curl -XDELETE 'http://localhost:9200/pms' | |
curl -XPUT 'http://localhost:9200/pms/Building/1' -d ' | |
{ | |
"id":11, | |
"building":{ | |
"address":{ | |
"street2":"test_street2_11", | |
"region":"test_region_11", | |
"id":11, |
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 Client { | |
public static void main(String[] args) { | |
int NBTEST = 100; | |
long all = 0; | |
for (int i=0; i < NBTEST; i++) { | |
long start = System.nanoTime(); | |
c1(); | |
all += System.nanoTime() - start; | |
} | |
System.out.println("Mean: " + all / NBTEST); |
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
#!/bin/sh | |
http://cloud.github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.10.zip | |
unzip elasticsearch-0.19.10.zip | |
elasticsearch-0.19.10/bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.6.0 | |
elasticsearch-0.19.10/bin/elasticsearch | |
sleep 10 |
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
#!/bin/bash | |
file=/usr/local/elasticsearch/elasticsearch-0.19.8/logs/es-twitter.log | |
if grep -q "TwitterException" $file | |
then | |
echo `date +'%Y-%m-%d %H:%M:%S'` ": Restarting ES" >> /home/ec2-user/es.log | |
/etc/rc.d/init.d/elasticsearch stop | |
rm $file | |
/etc/rc.d/init.d/elasticsearch start | |
fi |
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
/** | |
* @throws Exception | |
*/ | |
@Test | |
public void createSuggest() throws Exception { | |
node.client().prepareIndex("es1index", "type1").setSource("{\"email\" : \"abc@otherdomain.com\", \"firstname\" : \"abc\"}").execute().actionGet(); | |
node.client().prepareIndex("es1index", "type1").setSource("{\"email\" : \"abc@gmail.com\", \"firstname\" : \"abc\"}").execute().actionGet(); | |
node.client().prepareIndex("es1index", "type1").setSource("{\"email\" : \"xyz@gmail.com\", \"firstname\" : \"xyz\"}").execute().actionGet(); | |