Mettre en évidence les termes de recherche dans la réponse à 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
{
    "highlight": {
        "pre_tags": ["<tag1>"],
        "post_tags": ["</tag1>"],
        "fields": {
            "text_entry": {}
        }
    },
    "query": {
        "match": {
            "text_entry": "life"
        }
    }
}