小编Eme*_*ard的帖子

Elasticsearch 如何在索引中排除某些字段

我有一个 JSON 数据,当我索引数据时,它会通过弹性搜索自动映射。如何排除映射中的某些字段。我已经尝试手动定义地图,但是当我进行批量索引时,它会自动映射其他字段。

前任。我的 JSON 数据如下所示

[
 {
    "id": "232",
    "name": "Lorem",
    "description": "Ipsum Dolor",
    "image": [
             {"key": "asadasd.jpg"},
             {"key": "asasd2d.jpg"}
    ],
    "is_active": true
 },
 ...  
Run Code Online (Sandbox Code Playgroud)

我手动定义时的地图

PUT myindex
{
    "mappings": {
        "product": {
            "properties": {
                "id": { "type": "text },
                "name": { "type": "text"},
                "description": { "type": "text" },
                "is_active": { "type": "boolean" }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我想要实现的是数据仍然存在我只想排除不包含在索引中的图像属性。

所以当我在弹性搜索中查询时,我仍然得到带有图像的数据

那可能吗?

谢谢你们。我是弹性搜索的新手

{
    "id": "232",
    "name": "Lorem",
    "description": "Ipsum Dolor",
    "image": [
             {"key": "asadasd.jpg"},
             {"key": "asasd2d.jpg"}
    ],
    "is_active": true …
Run Code Online (Sandbox Code Playgroud)

elasticsearch

6
推荐指数
2
解决办法
3276
查看次数

标签 统计

elasticsearch ×1