Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neto-developer/5fb187c081890679007e481a33a827af to your computer and use it in GitHub Desktop.
Save neto-developer/5fb187c081890679007e481a33a827af to your computer and use it in GitHub Desktop.
ElasticSearch - Indice - Correção Ortografica
Analyser:
https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-suggesters-phrase.html
Template:
POST /_template/template_produtos
{
"index_patterns": [
"produto*"
],
"settings": {
"number_of_shards": 1,
"analysis": {
"analyzer": {
"trigram": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase","shingle"]
},
"reverse": {
"type": "custom",
"tokenizer": "standard",
"filter": ["lowercase","reverse"]
}
},
"filter": {
"shingle": {
"type": "shingle",
"min_shingle_size": 2,
"max_shingle_size": 3
}
}
}
},
"mappings": {
"produto": {
"_source": {
"enabled": true
},
"properties": {
"produtoDerivacao.id": {
"type": "long"
},
"produtoDerivacao.tituloCompleto": {
"type": "text",
"analyzer": "brazilian",
"fields": {
"trigram": {
"type": "text",
"analyzer": "trigram"
},
"reverse": {
"type": "text",
"analyzer": "reverse"
}
}
},
"produtoDerivacao.sku": {
"type": "text"
},
"produtoDerivacao.ean": {
"type": "text"
},
"produtoDerivacao.modelo": {
"type": "keyword"
},
"categoria_principal": {
"type": "text",
"analyzer": "brazilian"
},
"produtoDerivacao.produto.marca.nome": {
"type": "keyword"
},
"produtoDerivacao.numVendas": {
"type": "float"
},
"numAcessos": {
"type": "integer"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment