I am trying to use pyes with elasticsearch as full text search engine, I store only UUIDs and indexes of string fields, actual data is stored in MonogDB and retrieved using UUIDs. Unfortunately, I am unable to create a mapping that wouldn't store original data, I've tried various combinations of "store"/"source" fields and disabling "_all" but I can still get text of indexed fields. It seems that documentation is misleading on this topic as it's just a copy of original docs.

Can anyone please provide an example of mapping that would only store some fields and not the original document JSON?

有帮助吗?

解决方案

Sure, you could use something like this (with two fields, 'uuid' and 'body'):

{
  "mytype" : {
    "_source" : {
      "enabled" : false
    },
    "_all" : {
      "enabled" : false
    },
    "properties" : {
      "data" : {
        "store" : "no",
        "type" : "string"
      },
      "uuid" : {
        "store" : "yes",
        "type" : "string",
        "index" : "not_analyzed"
      }
    }
  }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top