Trying to workaround the terms limit of 65536 elements in the list. I’m being told by AI to use the termsLookup as an alternative, i.e. writing the list to an index and referring this index in my queries.
I write my client in Java with this client version:
<dependency> <groupId>co.elastic.clients</groupId> <artifactId>elasticsearch-java</artifactId> <version>8.15.5</version> </dependency>
Some questions:
Is this 65536 elements limit (still) really there?
Is using termsLookup a workaroud for this?
Why does not the (by AI) proposed code snippet work (there are no termsLookup available)?
Query lookupQuery = QueryBuilders.terms(t -> t
.field(fieldName)
.termsLookup(tl -> tl
.index(indexName)
.id(docId)
.path(fieldName)
)
);