We're updating the issue view to help you get more done. 

Distance projection may lead to missing hits in the Lucene and Elasticsearch backends

Description

See org.hibernate.search.documentation.searchdsl.projection.ProjectionDslIT#distance, added as part of HSEARCH-3597. The test passes with Elasticsearch, but there is absolutely no hit with Lucene, even though we're simply using the matchAll predicate.

EDIT: we appear to have a similar problem with the Elasticsearch backend for ES 5.6, though I don't think the root cause is the same. Later version may or may not work correctly: I didn't try. With Elasticsearch 5.6, I get this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 15:05:41,296 (Hibernate Search: Elasticsearch transport thread - 2) TRACE request:206 - HSEARCH400093: Executed Elasticsearch HTTP POST request to path '/org.hibernate.search.documentation.searchdsl.projection.author/_search' with query parameters {size=10000} and 1 objects in payload in 2ms. Response had status 200 'OK'. Request body: < { "query": { "match_all": {} }, "script_fields": { "distance_placeOfBirth_47_50606_2_473916_KILOMETERS": { "script": { "lang": "painless", "params": { "lat": 47.50606, "lon": 2.473916 }, "source": "doc[\u0027placeOfBirth\u0027].size() !\u003d 0 ? doc[\u0027placeOfBirth\u0027].arcDistance(params.lat, params.lon) : null" } } } } >. Response body: < { "took": 0, "timed_out": false, "_shards": { "total": 5, "successful": 3, "skipped": 0, "failed": 2, "failures": [ { "shard": 2, "index": "org.hibernate.search.documentation.searchdsl.projection.author", "node": "q3OLkQv3TGSRwv6UZp9nqA", "reason": { "type": "script_exception", "reason": "runtime error", "script_stack": [ "org.elasticsearch.index.mapper.MappedFieldType.failIfNoDocValues(MappedFieldType.java:432)", "org.elasticsearch.index.mapper.LatLonPointFieldMapper$LatLonPointFieldType.fielddataBuilder(LatLonPointFieldMapper.java:122)", "org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:111)", "org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:84)", "org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:81)", "java.security.AccessController.doPrivileged(Native Method)", "org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:81)", "org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:36)", "doc[\u0027placeOfBirth\u0027].size() !\u003d 0 ? doc[\u0027placeOfBirth\u0027].arcDistance(params.lat, params.lon) : null", " ^---- HERE" ], "script": "doc[\u0027placeOfBirth\u0027].size() !\u003d 0 ? doc[\u0027placeOfBirth\u0027].arcDistance(params.lat, params.lon) : null", "lang": "painless", "caused_by": { "type": "illegal_argument_exception", "reason": "Can\u0027t load fielddata on [placeOfBirth] because fielddata is unsupported on fields of type [geo_point]. Use doc values instead." } } } ] }, "hits": { "total": 2, "max_score": 1.0, "hits": [] } }

Environment

None

Status

Assignee

Unassigned

Reporter

Yoann Rodière

Fix versions

Priority

Major