Appliquer la correspondance floue à une requête
Cheat Sheet
PUT /shakespeare
{
"mappings": {
"properties": {
"speaker": {"type": "keyword"},
"play_name": {"type": "keyword"},
"line_id": {"type": "integer"},
"speech_number": {"type": "integer"}
}
}
}
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/bank/account/_bulk?pretty' --data-binary @accounts.json
curl -H 'Content-Type: application/x-ndjson' -XPOST 'localhost:9200/shakespeare/doc/_bulk?pretty' --data-binary @shakespeare_6.0.json
GET _cat/nodes?v
GET _cat/indices?v
### Recherche un terms via un boolean
GET _search
{
"query": {
"match": {
"text_entry": {
"query": "shame"
}
}
}
}
GET _search
{
"query": {
"match": {
"text_entry": {
"query": "shae"
}
}
}
}
GET _search
{
"query": {
"match": {
"text_entry": {
"query": "shae",
"fuzziness": 1
}
}
}
}
GET _search
{
"sort": [
{
"_score": {
"order": "asc"
}
}
],
"highlight": {
"pre_tags": ["**"],
"post_tags": ["**"],
"fields": {
"text_entry": {}
}
}
"query": {
"match": {
"text_entry": {
"query": "shame"
"fuzziness": 2
}
}
}
}
### Transposition des caractères
GET _search
{
"query": {
"fuzzy": {
"play_name": {
"value": "The tempest",
"fuzziness": 1,
"transpositions": false
}
}
}
}
GET _search
{
"query": {
"fuzzy": {
"play_name": {
"value": "Teh tempest",
"fuzziness": 1,
"transpositions": false
}
}
}
}
GET _search
{
"query": {
"fuzzy": {
"play_name": {
"value": "Teh tempest",
"fuzziness": 1,
"transpositions": true
}
}
}
}