I am having two issues using the java api
- I am not able to return specific field in my search query - It shows I
have the right number of results, but displays Null - Not return highlights
Note: Assume Indexing is fine, because I am able to get correct results if
comment out the line .AddField("hid")
I am using default everything, I understand for highlights _source for
field has to be enabled, but I thought if not, it grabs the original source.
json:
{"uid":'123", "name":"hello},
{"uid":'1234", "name":"hello1}
node = NodeBuilder.nodeBuilder() //
.local(true)//
.data(true) //
.node();
client = node.client();
//..createIndex
private void search(String index, String type,String field, String value)
{
SearchResponse response = client.prepareSearch(index)
.setTypes(type)
.addHighlightedField("uid")
.addField("uid")
SearchHit[] results = response.getHits().getHits();
System.out.println("Current results: " + results.length);
for (SearchHit hit : results) {
System.out.println("------------------------------");
Map<String,Object> result = hit.getSource();
System.out.println(result);
}
}
--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/4984505f-9946-4855-8bf0-5dd11b0a1b21%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.