Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting problem when mixing a match query and filtering by geo_distance in query context #19156

Closed
moliware opened this issue Jun 29, 2016 · 2 comments

Comments

@moliware
Copy link

Elasticsearch version: 2.3.2

JVM version: 1.8.0_92

OS version: Ubuntu 12.04.5 LTS

Description of the problem including expected versus actual behavior:

Say that we have a mapping with two properties:

  • description: analyzed string
  • location: geo_point

If I combine a match query on description and a geo_distance filter on location using a boolean query (that's why I say "filtering in query context"), Elasticsearch raises an error while highlighting. If I move the geo_distance filter to "post_filter context" it works fine.

I checked a bit the code and it seems to me that when creating the highlighting context in HighlightPhase, it uses description as field and geo_point as the type of the fieldMapper.

If you confirm that this is a bug I can look further and help with it.

Steps to reproduce:

PUT /test
{
    "mappings": {
        "test":{
            "dynamic": "false",
            "properties": {
                "description" :{
                    "type": "string"
                },
                "location": {
                  "type": "geo_point"
                }
            }
        }
    }
}

PUT /test/test/1
{
    "description": "Hello world",
    "location": {"lat": 1.0, "lon": 1.0}
}

POST /test/test/_search
{
  "from": 0,
  "size": 10,
  "query": {
    "bool": {
      "must": {
        "match": {
          "description": "hello"
        }
      },
      "filter": {
        "geo_distance": {
          "location": [
            1.0,
            1.0
          ],
          "distance": "10km"
        }
      }
    }
  },
  "highlight": {
    "fields": {
      "description": {
      }
    }
  }
}

Provide logs (if relevant):

This is the exception:

[2016-06-29 16:08:18,057][DEBUG][action.search            ] [Bella Donna] [44] Failed to execute fetch phase
RemoteTransportException[[Bella Donna][127.0.0.1:9300][indices:data/read/search[phase/fetch/id]]]; nested: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [description]]]; nested: NumberFormatException[Invalid shift value (111) in prefixCoded bytes (is encoded value really a geo point?)];
Caused by: FetchPhaseExecutionException[Fetch Failed [Failed to highlight field [description]]]; nested: NumberFormatException[Invalid shift value (111) in prefixCoded bytes (is encoded value really a geo point?)];
    at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:123)
    at org.elasticsearch.search.highlight.HighlightPhase.hitExecute(HighlightPhase.java:126)
    at org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:188)
    at org.elasticsearch.search.SearchService.executeFetchPhase(SearchService.java:592)
    at org.elasticsearch.search.action.SearchServiceTransportAction$FetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:408)
    at org.elasticsearch.search.action.SearchServiceTransportAction$FetchByIdTransportHandler.messageReceived(SearchServiceTransportAction.java:405)
    at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33)
    at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:75)
    at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:376)
    at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NumberFormatException: Invalid shift value (111) in prefixCoded bytes (is encoded value really a geo point?)
    at org.apache.lucene.spatial.util.GeoEncodingUtils.getPrefixCodedShift(GeoEncodingUtils.java:134)
    at org.apache.lucene.spatial.geopoint.search.GeoPointPrefixTermsEnum.accept(GeoPointPrefixTermsEnum.java:219)
    at org.apache.lucene.index.FilteredTermsEnum.next(FilteredTermsEnum.java:232)
    at org.apache.lucene.search.TermCollectingRewrite.collectTerms(TermCollectingRewrite.java:67)
    at org.apache.lucene.search.ScoringRewrite.rewrite(ScoringRewrite.java:108)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:220)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:227)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.extract(WeightedSpanTermExtractor.java:113)
    at org.apache.lucene.search.highlight.WeightedSpanTermExtractor.getWeightedSpanTerms(WeightedSpanTermExtractor.java:505)
    at org.apache.lucene.search.highlight.QueryScorer.initExtractor(QueryScorer.java:218)
    at org.apache.lucene.search.highlight.QueryScorer.init(QueryScorer.java:186)
    at org.apache.lucene.search.highlight.Highlighter.getBestTextFragments(Highlighter.java:195)
    at org.elasticsearch.search.highlight.PlainHighlighter.highlight(PlainHighlighter.java:108)
    ... 12 more

Thanks!

@clintongormley
Copy link

Hi @moliware - this will be fixed in 2.3.4 by #18495

@moliware
Copy link
Author

Thanks @clintongormley I did a couple of searches and couldn't find it. Sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants