Support synthetic _source for _doc_count field#91465
Conversation
|
Pinging @elastic/es-analytics-geo (Team:Analytics) |
|
Hi @nik9000, I've created a changelog YAML for you. |
| } | ||
|
|
||
| @Override | ||
| public abstract SourceLoader.SyntheticFieldLoader syntheticFieldLoader(); |
There was a problem hiding this comment.
I would like to make this abstract across the board just so everyone who makes a field has to think about it. If they don't want to support it, fine, but I'd like folks to think about it.
There was a problem hiding this comment.
But I didn't want to make it abstract in Mapper yet. It's just twice as many changes....
This add synthetic `_source` support for the `_doc_count` field so downsampling should play nicely with sythetic `_source`.
romseygeek
left a comment
There was a problem hiding this comment.
One question, LGTM otherwise!
| public void testSyntheticSourceMany() throws IOException { | ||
| DocumentMapper mapper = createDocumentMapper(syntheticSourceMapping(b -> {})); | ||
| List<Integer> counts = randomList(2, 10000, () -> between(1, Integer.MAX_VALUE)); | ||
| try (Directory directory = newDirectory()) { |
There was a problem hiding this comment.
Does withLuceneIndex not work here?
There was a problem hiding this comment.
Let me have another look. I think there was a reason, but it might not apply right here.
|
|
||
| @Override | ||
| public DocValuesLoader docValuesLoader(LeafReader leafReader, int[] docIdsInLeaf) throws IOException { | ||
| postings = leafReader.postings(new Term(DocCountFieldMapper.NAME, DocCountFieldMapper.NAME)); |
There was a problem hiding this comment.
nit: Does it make sense to make new Term(DocCountFieldMapper.NAME, DocCountFieldMapper.NAME) a static final constant?
| if (hasValue == false) { | ||
| return; | ||
| } | ||
| b.field("_doc_count", postings.freq()); |
There was a problem hiding this comment.
another nit: Maybe change "_doc_count" to DocCountFieldMapper.NAME?
This add synthetic
_sourcesupport for the_doc_countfield so downsampling should play nicely with sythetic_source.