Skip to content

Instantly share code, notes, and snippets.

View dadoonet's full-sized avatar
🇪🇺
From Europe with ❤️

David Pilato dadoonet

🇪🇺
From Europe with ❤️
View GitHub Profile
@dadoonet
dadoonet / ESTestCase.java
Created April 1, 2011 08:39
Exception when searching docs in ES with Java
package fr.pilato.hibernate.plugins.elasticsearch;
import static org.elasticsearch.index.query.xcontent.QueryBuilders.termQuery;
import static org.elasticsearch.node.NodeBuilder.nodeBuilder;
import static org.junit.Assert.assertEquals;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.search.SearchType;
import org.elasticsearch.client.Client;
import org.junit.Test;
@dadoonet
dadoonet / Output.txt
Created April 15, 2011 17:32
Highlighting _all does not work with Elastic Seach
Starting test
{"ok":true,"_index":"test","_type":"dossier","_id":"1","_version":19}
{"ok":true,"_index":"test","_type":"dossier","_id":"2","_version":13}
{
"took" : 6,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
@dadoonet
dadoonet / 01-create.sh
Created June 14, 2011 11:52
ES Terms Facet send back bad count results
# Dropping index and Creating articles
curl -X DELETE "http://localhost:9200/articles"
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["one", "two", "three", "four", "five", "six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["two", "three", "four", "five", "six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["three", "four", "five", "six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["four", "five", "six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["five", "six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["six", "seven"]}'
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["seven"]}'
@dadoonet
dadoonet / MyClass.java
Created November 21, 2011 17:43
MyEnum
package fr.pilato.test.jackson;
import org.codehaus.jackson.map.annotate.JsonSerialize;
@JsonSerialize
public class MyClass {
@JsonSerialize
private String myProp;
@JsonSerialize
@dadoonet
dadoonet / LigneRegistre.json
Created December 14, 2011 16:30
Create Mappings
{
"LigneRegistre": {
"properties": {
"personne": {
"dynamic": "true",
"properties": {
"PersonneMorale": {
"dynamic": "true",
"properties": {
"fax": {
@dadoonet
dadoonet / startrivers.sh
Created January 26, 2012 20:35
Launching multiple couchdb river
curl -XPUT 'localhost:9200/_river/my_river1/_meta' -d '{
"type" : "couchdb",
"couchdb" : {
"host" : "localhost",
"port" : 5984,
"db" : "my_db",
"filter" : null
},
"index" : {
"index" : "my_db",
@dadoonet
dadoonet / recreation.sh
Created February 20, 2012 23:19
disabling source curl recreation
# Delete the index
curl -XDELETE http://localhost:9200/twitter
# Create the index
curl -XPUT http://localhost:9200/twitter
# Create the mapping using only fields
curl -XPOST http://localhost:9200/twitter/tweet/_mapping -d '{
"tweet" : {
"_source" : {"enabled" : false},
@dadoonet
dadoonet / defaultvalues.sh
Created March 21, 2012 07:24
ES : Trying to play with default values
#!/bin/bash
ES='http://localhost:9200'
ESIDX='test3'
ESTYPE='test'
curl -XDELETE $ES/$ESIDX/$ESTYPE
curl -XPUT $ES/$ESIDX/$ESTYPE/_mapping -d '{
"test" : {
@dadoonet
dadoonet / fr.sh
Created March 21, 2012 10:27
French analyzer for ES
#!/bin/bash
ES='http://localhost:9200'
ESIDX='test3'
ESTYPE='test'
curl -XDELETE $ES/$ESIDX
curl -XPUT $ES/$ESIDX/ -d '{
"settings" : {
@dadoonet
dadoonet / es-twitter.log
Created March 29, 2012 17:20
ES Twitter River log
[2012-03-29 00:01:06,848][TRACE][index.translog ] [Princess Python] [_river][0] flushing translog, last_flush_time [1332977461805], breached [30m]
[2012-03-29 00:01:06,849][TRACE][index.shard.service ] [Princess Python] [_river][0] flush with full[false], refresh[false], force[false]
[2012-03-29 00:12:34,702][TRACE][index.translog ] [Princess Python] [devoxx][3] flushing translog, last_flush_time [1332978154502], breached [30m]
[2012-03-29 00:12:34,702][TRACE][index.shard.service ] [Princess Python] [devoxx][3] flush with full[false], refresh[false], force[false]
[2012-03-29 00:12:44,313][TRACE][index.translog ] [Princess Python] [devoxx][2] flushing translog, last_flush_time [1332978164106], breached [30m]
[2012-03-29 00:12:44,313][TRACE][index.shard.service ] [Princess Python] [devoxx][2] flush with full[false], refresh[false], force[false]
[2012-03-29 00:12:49,006][TRACE][index.translog ] [Princess Python] [devoxx][1] flushing translog, last_flush_time