django-elasticsearch-dsl icon indicating copy to clipboard operation
django-elasticsearch-dsl copied to clipboard

Filter populate command

Open sajadbahar opened this issue 7 years ago • 5 comments

Here is implement of populate with filter,

you could use Django filter phrase like {field_name}__gte, ...

sajadbahar avatar Oct 25 '17 10:10 sajadbahar

Any progress on fixing and merging this? I find this an important feature.

herrdiener avatar May 31 '20 06:05 herrdiener

@herrnici Can you explain your usecase?

safwanrahman avatar May 31 '20 14:05 safwanrahman

@safwanrahman A large table of versioned data (division into multiple models is not an option), where only current data is needed for search, and therefore only current data should be indexed. Of course this would also work by

  • filtering every search (wastes space, slight runtime impact)
  • manually deleting the majority of the data from the index after every build (inconvenient, temporarily wastes space), or
  • changing the default manager to only include partial data (has impacts on other components).

But I feel needing only a subset of data isn't that uncommon a use case.

herrdiener avatar Jun 01 '20 06:06 herrdiener

@herrnici, given your usecase, why don't you simply override get_queryset in you Document class ?

alexgarel avatar Jun 01 '20 08:06 alexgarel

Good point, that should cover all cases. No idea why I didn't think of that. In that case this PR is really somewhat redundant. Thank you and sorry for the ping.

herrdiener avatar Jun 01 '20 10:06 herrdiener