A
A
Andrey2018-12-22 19:45:07
elasticsearch
Andrey, 2018-12-22 19:45:07

How to get the value of fields field in Elasticsearch mapping?

There is such a mapping used for aggregation:

'mappings': {
    'my_type': {
        'properties': {
            'brand': {
                'type': 'string',
                'fields': {
                    'keyword': {
                        'type': 'string'
                    }
                }
            }
        }
    }
}

Only brand is displayed in the search results. How can I get the brand.keyword value?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Cheremisin, 2018-12-22
@leahch

You can't get it, you can only search for it. And from _sources you can only get the original brand field. Additional fields created by the elastic go directly to the Lucinian index as terms, in your case the value of the brand field will go there completely. But this field will not glow anywhere else. The value of this field cannot be torn out of the lyucine.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question