GET /
#### 1ST PART CRUD
DELETE villes
# Create the first doc
PUT villes/_doc/cergy
{
"message": "Ici c'est Cergy"
}
GET villes/_doc/cergy
# Add a field
PUT villes/_doc/cergy
{
"message": "Ici c'est Cergy",
"meteo": "nuageux"
}
GET villes/_doc/cergy
# Remove the doc
DELETE villes/_doc/cergy
GET villes/_doc/cergy
# Create some documents
POST villes/_doc/
{
"message": "Ici c'est Cergy",
"meteo": "nuageux",
"nom": "Cergy"
}
# Just one or two
POST villes/_doc/
{
"message": "Ici c'est Cergy Pontoise",
"meteo": "nuageux",
"nom": "Cergy Pontoise"
}
# Create some other documents
POST villes/_doc/
{
"message": "Ici c'est Pontoise",
"meteo": "pluie",
"nom": "Pontoise"
}
POST villes/_doc/
{
"message": "Ici c'est Montréal",
"meteo": "beau",
"nom": "Montréal"
}
#### SEARCH
# Search all
GET villes/_search
GET villes/_search
{
"query": {
"match": {
"message": "cergy"
}
}
}
GET villes/_search
{
"query": {
"match": {
"message": "CERGY!"
}
}
}
GET villes/_search
{
"query": {
"match": {
"message": "cergy pontoise"
}
}
}
#### 2nd Part: INJECTOR
# Inject data
# Run aggregations
# Play in Kibana
# Show monitoring
# Scale Out
GET person/_search?track_total_hits=true
# Launch faster recovery
PUT _all/_settings
{
"settings": {
"index.unassigned.node_left.delayed_timeout": "0"
}
}
# Back To Slides
#### 3RD PART ANALYZE
POST _analyze
{
"text": [ "The quick brown fox jumps over the lazy Dog!" ]
}
POST _analyze
{
"analyzer": "english",
"text": [ "The quick brown fox jumps over the lazy Dog!" ]
}
# Start with ... And add the other filters
POST _analyze
{
"tokenizer": "standard",
"filter": [
"lowercase"
],
"text": [ "L'éléphant est ROSE et il trompe énormément !" ]
}
POST _analyze
{
"explain": true,
"tokenizer": "standard",
"filter": [
"lowercase",
{"type": "stop", "stopwords": [ "_french_" ]},
{"type": "elision", "articles" : ["l", "m", "t", "qu", "n", "s", "j"]},
{"type": "stemmer", "name": "light_french"},
"asciifolding"
],
"text": [ "L'éléphant est ROSE et il trompe énormément !" ]
}
POST _analyze
{
"analyzer": "french",
"text": [ "L'éléphant est ROSE et il trompe énormément !" ]
}
## Not so light
POST _analyze
{
"tokenizer": "standard",
"filter": [
"lowercase",
{"type": "stop", "stopwords": [ "_french_" ]},
{"type": "elision", "articles" : ["l", "m", "t", "qu", "n", "s", "j"]},
{"type": "stemmer", "name": "french"},
"asciifolding"
],
"text": [ "L'éléphant est ROSE et il trompe énormément !" ]
}
POST _analyze
{
"tokenizer": "standard",
"filter": [
"lowercase",
{"type": "stop", "stopwords": [ "_french_" ]},
{"type": "elision", "articles" : ["l", "m", "t", "qu", "n", "s", "j"]},
{"type": "stemmer", "name": "french"},
"asciifolding"
],
"text": [ "Des éléphantes" ]
}
## Bizarre ?
POST _analyze
{
"analyzer": "french",
"text": [ "Un avion" ]
}
POST _analyze
{
"analyzer": "french",
"text": [ "Des avions" ]
}
## Ngrams
POST _analyze
{
"tokenizer": "standard",
"filter": [
{"type": "edgeNGram", "min_gram" : 2, "max_gram" : 5}
],
"text": [ "eleph" ]
}
POST _analyze
{
"tokenizer": "standard",
"filter": [
{"type": "nGram", "min_gram" : 2, "max_gram" : 3}
],
"text": [ "eleph" ]
}
DELETE mon_index
PUT mon_index
{
"settings": {
"number_of_shards": 1,
"number_of_replicas": 0,
"analysis": {
"analyzer": {
"francais": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"stop_francais",
"fr_stemmer",
"asciifolding",
"elision"
]
},
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"elision",
"lowercase",
"asciifolding",
"autocomplete"
]
}
},
"filter": {
"stop_francais": {
"type": "stop",
"stopwords": [
"_french_",
"twitter"
]
},
"fr_stemmer": {
"type": "stemmer",
"name": "french"
},
"elision": {
"type": "elision",
"articles": [
"l",
"m",
"t",
"qu",
"n",
"s",
"j",
"d",
"lorsqu"
]
},
"autocomplete": {
"type": "edgeNGram",
"min_gram": 2,
"max_gram": 5
}
}
}
},
"mappings": {
"properties": {
"description": {
"type": "text",
"analyzer": "francais"
},
"username": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "simple"
},
"city": {
"type": "text",
"analyzer": "francais",
"fields": {
"ngram": {
"type": "text",
"analyzer": "autocomplete",
"search_analyzer": "simple"
},
"raw": {
"type": "keyword"
}
}
}
}
}
}
POST mon_index/_analyze
{
"text": [ "Cergy", "Cénac" ],
"analyzer": "autocomplete"
}
POST mon_index/_analyze
{
"text": [ "Cer" ],
"analyzer": "autocomplete"
}
POST mon_index/_analyze
{
"text": [ "Cer" ],
"analyzer": "simple"
}
POST mon_index/_analyze
{
"text": [ "J'habite à Cergy" ],
"analyzer": "francais"
}
view raw bbl.json hosted with ❤ by GitHub