Question

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?

Was it helpful?

Solution

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"
      }
    }
  }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top