Skip to content

Storing additional data #2083

@CGenie

Description

@CGenie

Hello,
I want to have an index, but one that stores some additional data so that when I query the index, I can fetch that data (not search on it). How can I do it?

I tried something like type Tags = map[string]string and

tagsMapping := bleve.NewKeywordFieldMapping()
tagsMapping.Analyzer = ""
tagsMapping.Index = false
tagsMapping.Store = true

docMapping.AddFieldMappingsAt("tags", tagsMapping)

Apparently I can index my document with Tags, but when I try to search for it like this:

searchReq.Fields = []string{"address", "city", "geo", "tags"}
...
myDoc.Tags = hit.Fields["tags"].(map[string]string)

I get an error:

interface conversion: interface {} is nil, not map[string]string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions