-2

We are getting a nullpointerexception at searchResponse.getHits().getHits(); I'm totally new to elastic search and don't know how it works but need to analyse this issue.

Let me know if it throws nullpointerexception in any case ? If it throws how to handle this ?

  • Possible duplicate of [What is a NullPointerException, and how do I fix it?](https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it) – George Z. Feb 18 '19 at 15:02
  • would you post your code (or a sample that could reproduce the issue)? – Leonardo Alves Machado Feb 18 '19 at 15:02
  • *and don't know how it works* I would suggest reading their documentation, the do a great job at keeping it up to date – Lino Feb 18 '19 at 15:03

1 Answers1

0

Looking at the code of InternalSearchResponse, it looks like hits gets initialised with SearchHits.empty() even if the response is empty.

For the other cases, it always gets initialised with new. You can have a look at the source code here.

Darshan Mehta
  • 27,835
  • 7
  • 53
  • 81