Created
June 11, 2013 08:07
-
-
Save damienalexandre/5755194 to your computer and use it in GitHub Desktop.
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/pony_index_tmp' | |
curl -XPUT 'http://localhost:9200/pony_index_tmp' -d ' | |
{ | |
"number_of_shards": 5, | |
"number_of_replicas": 1, | |
"analysis": { | |
"analyzer": { | |
"francais": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", | |
"asciifolding", | |
"elision" | |
], | |
"char_filter": [ | |
"dot_remover" | |
] | |
}, | |
"stemmer": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": [ | |
"lowercase", | |
"asciifolding", | |
"elision", | |
"stemmer_fr" | |
], | |
"char_filter": [ | |
"dot_remover" | |
] | |
} | |
}, | |
"char_filter": { | |
"dot_remover": { | |
"type": "mapping", | |
"mappings": [ | |
".=>" | |
] | |
} | |
}, | |
"filter": { | |
"stemmer_fr": { | |
"type": "stemmer", | |
"name": "minimal_french" | |
}, | |
"elision": { | |
"type": "elision", | |
"articles": [ | |
"l", | |
"m", | |
"t", | |
"qu", | |
"n", | |
"s", | |
"j", | |
"d" | |
] | |
}, | |
"edge_ngram": { | |
"side": "front", | |
"max_gram": 10, | |
"min_gram": 1, | |
"type": "edgeNGram" | |
} | |
} | |
} | |
}' | |
curl -XPUT 'http://localhost:9200/pony_index_tmp/label/_mapping' -d ' | |
{ | |
"label": { | |
"_source": { | |
"enabled": true, | |
"excludes": [ | |
"private_data" | |
] | |
}, | |
"_all": { | |
"analyzer": "francais", | |
"index": "analyzed", | |
"type": "string" | |
}, | |
"properties": { | |
"id": { | |
"type": "integer" | |
}, | |
"name": { | |
"type": "multi_field", | |
"fields": { | |
"name": { | |
"type": "string", | |
"boost": 30 | |
}, | |
"stemmed": { | |
"type": "string", | |
"boost": 10, | |
"analyzer": "stemmer" | |
} | |
} | |
}, | |
"slug": { | |
"type": "string", | |
"index": "not_analyzed" | |
}, | |
"albums_count": { | |
"type": "integer", | |
"index": "not_analyzed" | |
}, | |
"description": { | |
"type": "string" | |
}, | |
"private_data": { | |
"type": "object" | |
} | |
} | |
} | |
}' | |
curl -XPOST "http://localhost:9200/pony_index_tmp/label/1" -d ' | |
{ | |
"id":1, | |
"name":"Ace of spade", | |
"slug":"toto1", | |
"albums_count":12 | |
} | |
' | |
curl -XPOST "http://localhost:9200/pony_index_tmp/label/2" -d ' | |
{ | |
"id":2, | |
"name":"Queens of the stone age", | |
"slug":"toto2", | |
"albums_count":23 | |
} | |
' | |
curl -XPOST "http://localhost:9200/pony_index_tmp/label/3" -d ' | |
{ | |
"id":3, | |
"name":"Queen", | |
"slug":"toto3", | |
"albums_count":41 | |
} | |
' | |
curl -XPOST "http://localhost:9200/pony_index_tmp/label/4" -d ' | |
{ | |
"id":4, | |
"name":"Gypsy Queens", | |
"slug":"toto4", | |
"albums_count":22 | |
} | |
' | |
curl -XGET 'http://localhost:9200/pony_index_tmp/_search?pretty=true' -d ' | |
{"query": { | |
"match" : { | |
"_all": { | |
"query": "queens" | |
} | |
} | |
} | |
}' | |
curl -XGET 'http://localhost:9200/pony_index_tmp/_search?pretty=true' -d ' | |
{"query": { | |
"match" : { | |
"_all": { | |
"query": "queen" | |
} | |
} | |
} | |
}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment