elasticsearch,Couchdb,elasticsearch" /> elasticsearch,Couchdb,elasticsearch" />

通过CouchDB River排除Elasticsearch索引的字段

通过CouchDB River排除Elasticsearch索引的字段,couchdb,elasticsearch,Couchdb,elasticsearch,我正在用CouchDB River插件索引电子搜索。目前,我正在尝试实现用户搜索,其中一个简化的文档如下所示: { username: "john", firstname: "John", lastname: "Doe", email: "john.doe@example.com", password: "someHash" } 我不希望密码在ES中被索引,因为我不认为这样做有任何用处,但也许我在这里错了(我对ES相当陌生) 我确实通过执行以下命令建立了河流: curl -

我正在用CouchDB River插件索引电子搜索。目前,我正在尝试实现用户搜索,其中一个简化的文档如下所示:

{
  username: "john",
  firstname: "John",
  lastname: "Doe",
  email: "john.doe@example.com",
  password: "someHash"
}
我不希望密码在ES中被索引,因为我不认为这样做有任何用处,但也许我在这里错了(我对ES相当陌生)

我确实通过执行以下命令建立了河流:

curl -XPUT 'http://localhost/_river/st_user/_meta' -d '{
  "type" : "couchdb",
  "couchdb" : {
    "host" : "localhost",
    "port" : 5984,
    "db" : "sportstracker_usertest",
    "ignore_attachments":true,
    "filter" : null
    }
  },
  "index" : {
    "index" : "tracker",
    "type" : "user",
    "bulk_size" : "100",
    "bulk_timeout" : "10ms"
  }
}'
您可以通过河流(脚本过滤器)或ES映射来实现这一点吗?

根据

虽然筛选器只能筛选整个文档

除了使用过滤器,Elasticsearch还有一个
脚本
钩子来预处理输入数据

{
  "type" : "couchdb",
  "couchdb" : {
    "host" : "localhost",
    "port" : 5984,
    "db" : "sportstracker_usertest",
    "ignore_attachments":true,
    "filter" : "NAME_OF_FILTER_IN_COUCHDB",
    "filter_params" : {
      "FIRST_PARAMETER_ON_THAT_FILTER" : "VALUE_YOU_WANT_TO_PASS",
      "userStatus" : "online",
      "minSubscriptors" : "1"
    }
  },
  "index" : {
    "index" : "tracker",
    "type" : "user",
    "bulk_size" : "100",
    "bulk_timeout" : "10ms"
  }
}
{
  "type" : "couchdb",
  "couchdb" : {
    "script" : "ctx.doc.password = undefined"
  },
  "index" : {
  }
}