-
Notifications
You must be signed in to change notification settings - Fork 801
[Fix #1091] Index.document() does not set index on Document class #1099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
c8e405f
to
c47e35a
Compare
Thank you for working on this, I was hoping to get to it next week but this is much better. I think the ideal solution here would be to detect somehow that the I would like to avoid the situation where Does that make sense? Thank you again for picking this up! |
Thanks a lot @honzakral for taking it in the vacation time. The From my prespective, I think we should handle the document inheritance like django handle model inheritance. We can add What do you think?
Thats true. But I think we need to fix this from our end as well as from user end. |
Thank you for the discussion, very useful!
There is no problem with running a query on You can always have a I am also a huge fan of the simplicity of defining a In other cases I like to just be able to access the Overall I really think that having That leaves us with several options:
I am leaning towards What do you think? |
I understand your point. class AllDocument(Document):
class Index:
name = '*' Do you think having it implicit is better than explicit? If you dont want user to add the wildcard index name explicitly, I also think going with option |
I also agree with this. In that case we can have a index with name |
@honzakral I think having By doing this, we can differenciate in the What do you think? |
@honzakral possible to have a review again? |
Hi! @safwanrahman I met the similar problem when i use Index.document like this: test_index1 = Index('test_index1')
test_index2 = Index('test_index2')
ascii_fold = analyzer(
'ascii_fold',
# we don't want to split O'Brian or Toulouse-Lautrec
tokenizer='whitespace',
filter=[
'lowercase',
token_filter('ascii_fold', 'asciifolding')
]
)
@test_index1.document
@test_index2.document
class testDoc(Document):
user_name = Completion(analyzer = ascii_fold)
def save(self, ** kwargs):
self.update_time = int(time.time() * 1000)
kwargs['index'] = 'test_index1'
return super().save(** kwargs)
......
if __name__ == '__main__':
testDoc.init() Could you tell me how to resolve it? Thanks! And my elasticsearch-dsl version is 6.3.1 |
Sorry for the delays, finally pushed as 29863b3 Thank you for working on this, much appreciated! |
This will fix #1091
In the previous versions, the
Index.document()
method added theIndex
to theDocument
class. But it was removed in 69f5ca2 in order to implement the inheritance document.This patch will add
Index
to theDocument
class moreover also setNone
toDocument._index
property ifIndex
Innesclass is not in set.@honzakral r?