Closed foolcage closed 6 years ago
Thank you, could you please share the definition of the document class that causes this exception?
here is the document:
class PriceCondition(BaseDocType):
securityType = Keyword()
exchange = Keyword()
code = Keyword()
upPct = Float()
downPct = Float()
upTo = Float()
downTo = Float()
class PriceSubscription(BaseDocType):
"""
{
"id": 123,
"userId": 111,
"type": "price",
"condition": {
"securityType": "cryptocurrency",
"exchange": "binance",
"code": "BTC-USDT",
"upPct": 1,
"downPct": 2,
"up": 7000,
"down": 6000
},
"actions": [weixin,email,shortMsg],
"repeat": False
}
"""
id = Keyword()
userId = Keyword()
condition = Nested(PriceCondition)
repeat = Boolean()
actions = Keyword()
class Meta:
doc_type = 'doc'
all = MetaField(enabled=False)
https://github.com/foolcage/fooltrader/blob/bot/fooltrader/domain/subscription_model.py
I try elasticsearch-dsl == 6.2.1 and it cause the error,so I switched to 6.1.0 now.
Problem is that PriceCondition
cannot extend DocType
but must be extending InnerDoc
.I will make a note to fix it so that it won't break but for now just change its base from BaseDocType
to InnerDoc
and it should help.
Hi, Imagine you want PriceCondition to be a real Document (for example for some Kibana graphs) but you also wan't to add a PriceCondition within a PriceSubscription Document. How should we do this ?
Regards,
I'm having similar issue, with
elasticsearch==6.3.1 elasticsearch-dsl==6.3.1
class ReviewMeta(InnerDoc):
id = Integer()
name = Keyword()
tags = Keyword()
location = GeoPoint()
area_names = Keyword()
class ReviewMetaSearchClickLogDoc(DocType):
id = Integer()
created_at = Date()
search_log_id = Integer()
review_meta = Object(ReviewMeta)
position = Integer()
class Index:
name = REVIEWMETA_SEARCH_CLICK_LOG_INDEX
class ReviewMetaSearchLogDoc(DocType):
id = Integer()
created_at = Date()
user = Object(User)
result_count = Integer()
search_data = Object(dynamic=True)
clicks = Nested(ReviewMetaSearchClickLogDoc, include_in_parent=True)
class Index:
name = REVIEWMETA_SEARCH_LOG_INDEX
I guess the problem is Nested(ReviewMetaSearchClickLogDoc, include_in_parent=True)
, why is it a problametic, and how can I fix it?
I use elasticsearch-dsl == 6.2.1
Got error: