Skip to content

Instantly share code, notes, and snippets.

@dadoonet
Forked from anonymous/index_test.sh
Created December 11, 2013 16:07
Show Gist options
  • Save dadoonet/7913176 to your computer and use it in GitHub Desktop.
Save dadoonet/7913176 to your computer and use it in GitHub Desktop.
curl -XDELETE "http://localhost:9200/test"; echo
curl -XPUT "http://localhost:9200/test" -d'
{
"settings": {
"index": {
"number_of_shards": 1,
"number_of_replicas": 0
},
"analysis": {
"analyzer": {
"myAnalyser": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"asciifolding",
"lowercase",
"myElision",
"myStop"
]
}
},
"filter": {
"myStop": {
"type": "stop",
"stopwords": [
"de",
"van"
]
},
"myElision": {
"type": "elision",
"articles": [
"a",
"b"
]
}
}
}
}
}'; echo
curl -XPUT "http://localhost:9200/test/personne2/_mapping" -d'
{
"personne2": {
"properties": {
"nom": {
"type": "string",
"path": "nom",
"analyzer": "myAnalyser"
},
"dspt_nom_conjoint": {
"type": "string",
"path": "dspt_nom_conjoint",
"analyzer": "myAnalyser"
},
"dt_naiss": {
"type": "string",
"path": "dt_naiss",
"analyzer": "myAnalyser"
},
"prenoms": {
"properties": {
"prenom": {
"type": "string",
"analyzer": "myAnalyser"
}
}
}
}
}
}'; echo
curl -XPUT "http://localhost:9200/test/personne2/1?refresh" -d '{
"nom": "Espérance",
"dspt_nom_conjoint": "Jaquot",
"dt_naiss": "01011956",
"prenoms" : {
"prenom": "eric"
}
}'
curl -XPOST "http://localhost:9200/test/personne2/_search?pretty" -d '{
"query" : {
"match" : {
"nom" : "Espérance"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment