A numeric id field is (which gets indeed as string) still gets target by a {{NumericRangeQuery}} when using the {{QueryBuilder}} DSL. For example:
{code} @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name="userId", nullable=false, insertable=false, updatable=false) @DocumentId public Long getId() { return id; } {code} {code} qb.keyword().onField("id").matching(myLongId).createQuery() {code}
The query builder needs to take the field metadata into account and not decide on the type of query purely based on the property type, but also whether or not it is the document id.
A workaround is to map the field using {{@NumericField}}.
|