Skip to content

Commit

Permalink
Add support for 'constant_keyword'
Browse files Browse the repository at this point in the history
  • Loading branch information
sethmlarson committed Dec 2, 2020
1 parent e275344 commit 5487df0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions elasticsearch_dsl/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,10 @@ class Keyword(Field):
name = "keyword"


class ConstantKeyword(Keyword):
name = "constant_keyword"


class Boolean(Field):
name = "boolean"
_coerce = True
Expand Down
5 changes: 5 additions & 0 deletions tests/test_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def test_binary():
assert f.deserialize(None) is None


def test_constant_keyword():
f = field.ConstantKeyword()
assert f.to_dict() == {"type": "constant_keyword"}


def test_object_dynamic_values():
for dynamic in True, False, "strict":
f = field.Object(dynamic=dynamic)
Expand Down

0 comments on commit 5487df0

Please sign in to comment.