Skip to content

Instantly share code, notes, and snippets.

View clintongormley's full-sized avatar

Clinton Gormley clintongormley

  • Barcelona, Spain
View GitHub Profile
@clintongormley
clintongormley / gist:949602
Created April 30, 2011 11:02 — forked from monken/gist:934765
camelcase tokenizer
curl -XDELETE localhost:9200/test
curl -XPUT 'localhost:9200/test?pretty=1' -d '
{
"settings":{
"analysis": {
"analyzer": {
"camel":{
"type": "pattern",
"lowercase": true,
"pattern":"([^\\p{L}\\d]+)|(?<=\\D)(?=\\d)|(?<=\\d)(?=\\D)|(?<=[\\p{L}&&[^\\p{Lu}]])(?=\\p{Lu})|(?<=\\p{Lu})(?=\\p{Lu}[\\p{L}&&[^\\p{Lu}]])"
curl -XPUT 'http://localhost:9200/testme/testme' -d '{
streamType: "Feed",
tenantId: "1",
message: "bla bla bla post bla bla 1 bla",
description: "Description",
postDate:"2010-06-03T21:11:09+0300"
}'
curl -XPOST 'http://localhost:9200/testme/testme/_search' -d '{ sort:{postDate:{reverse:true}}, size:100, query : { bool : {must : [ {wildcard : { message : "*post*" }}, {term : { tenantId : "1" }} ] }} ,"highlight" : { "pre_tags" : ["<em class='highlight'>"], "post_tags" : ["</em>"], "fields" : {"message" : {"fragment_size" : 200, "number_of_fragments" : 1}}}}'