sql >> Base de Datos >  >> NoSQL >> MongoDB

Cómo hacer un mapeo mientras se indexa en elasticsearch

Eliminar el índice existente

curl -XDELETE "http://hostname:9200/index/type"

Eliminar el índice de configuración del río existente

curl -XDELETE "http://hostname:9200/_river"

Crear mapeo para indexar

curl -XPUT "http://hostname:9200/index/type/_mapping" -d'
{
"allnews": {
    "properties": {
        "category": {
            "type": "string"
        },
        "description": {
            "type": "string"
        },
        "link": {
            "type": "string"
        },
        "state": {
            "type": "string",
            "index" : "not_analyzed"
        },
        "title": {
            "type": "string"
        }
    }
}
}'

Después de estos pasos, coloque la sincronización de configuración del complemento de río mongodb en elasticsearch.

¡Espero que ayude...!