I created a JSON Document as follows:
JSONArray jArray = new JArray();
JSONObject jObject = new JSONObject();
For Searching I am writing following code:
SearchResponse searchResponse = client.prepareSearch("twitter")
SearchHits sh = searchResponse.getHits();
System.out.println("Total Hits are sh.totalHits() : "+sh.hits().length);
I have not done any configuration what ever is default.
My Problems are:
- I am getting only 1 hit but it should give 2 because (as I understand) j* will search jhon and jerry
- How can i get the value of the hit( for eg if jhon is found then how can i get printed jhon)
- If i make any change in the JSONObject and run the program the changes are not reflected in one time i need to run once again.
I have spent lots of time in finding the reasons for these but I could not get.
Please help to resolve the problem
May be title doesnot suite the problem, sorry for that