문제

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