Skip to content

Instantly share code, notes, and snippets.

curl 'localhost:9200/twitter/tweet/_search' -d '{
"query" : {
"text" : {
"@ABCD:owner" : "mongo"
}
}
}'
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.common.settings.ImmutableSettings;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.node.Node;
import org.elasticsearch.node.NodeBuilder;
import org.elasticsearch.search.facet.FacetBuilders;
import org.elasticsearch.search.facet.datehistogram.DateHistogramFacet;
import org.joda.time.DateTimeZone;
import org.joda.time.format.ISODateTimeFormat;
curl 'http://localhost:9200/my_index/my_type/_search?analyze_wildcard=true&q=Ing%25e9nieur*'
curl 'http://localhost:9200/my_index/my_type/_search?analyze_wildcard=true&q=Ing%25e9n*'
curl localhost:9200/my_index/my_type/_search -d '{
"query" : {
"query_string" : {
"query" : "Ingénieur*",
"analyze_wildcard" : true
}
}
}'
curl -XPUT localhost:9200/test -d '
{
"settings" : {
"index": {
"analysis": {
"analyzer": {
"manualindexanalyzer": {
"type": "custom",
"tokenizer": "whitespace",
"filter": [
curl 'localhost:9200/test/foo/_search?pretty=1&explain=0' -d '{
"query":{
"dis_max":{
"queries":[
{
"custom_boost_factor" : {
"query" : { "text": { "name": { query: "Nick" } } },
"boost_factor" : 5.0
}
}
curl localhost:9200/_search -d '{
"query" : {
"filtered" : {
"query" : {
"term" : { "tag" : "wow" }
},
"filter" : {
"range" : {
"age" : { "from" : 10, "to" : 20 }
}
curl -XPUT localhost:9200/_template/logstash -d '{
"template" : "logstash-*"
"mappings" : {
"vlive-access" : {
"properties" : {
"@fields" : {
"properties" : {
"agent" : {
"type" : "string",
"index" : "not_analyzed"
@kimchy
kimchy / gist:1626305
Created January 17, 2012 11:23
lucene english stopwords
final List<String> stopWords = Arrays.asList(
"a", "an", "and", "are", "as", "at", "be", "but", "by",
"for", "if", "in", "into", "is", "it",
"no", "not", "of", "on", "or", "such",
"that", "the", "their", "then", "there", "these",
"they", "this", "to", "was", "will", "with"
);
@kimchy
kimchy / gist:1597555
Created January 11, 2012 23:54
Very simply test to show the cost of stats in guava cache
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
curl -XPUT localhost:9200/_settings -d '{
"index.merge.policy.segments_per_tier" : 5,
"index.merge.policy.max_merge_at_once" : 5
}'