Elasticsearch-dsl-py: Support for constant_keyword

Created on 16 Jun 2020  路  4Comments  路  Source: elastic/elasticsearch-dsl-py

When trying to add a field of type constant_keyword to a Mapping, an exception is returned:

DSL class `constant_keyword` does not exist in field.
good first issue

Most helpful comment

@sethmlarson I'm definitely willing to contribute! I'll try to find some time this week.

All 4 comments

Creating a custom field using:

class ConstantKeyword(Keyword):
    name = 'constant_keyword'

and then

mapping.field('service_name', ConstantKeyword(value=svc_name))

Seems to result in the correct mapping being applied. Not sure if this is the right way to do it.

From https://github.com/elastic/kibana/issues/52635, it turns out Kibana does not yet support the type either, so it is not that useful to us at the moment.

Thanks for identifying this, would you be up to creating a PR with the feature and a test case?

@sethmlarson I'm definitely willing to contribute! I'll try to find some time this week.

@beanaroo - I'm also willing to help! It's your find, so I'll let you take the lead on this. But if you want my help (or if you can't find time to whip up a PR), feel free to ping me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MauriJHN picture MauriJHN  路  4Comments

rokcarl picture rokcarl  路  4Comments

vanzi picture vanzi  路  4Comments

ypkkhatri picture ypkkhatri  路  4Comments

njoannin picture njoannin  路  3Comments