I found that using the plugin elastisearch-head really helped me monitor my
indexes.
Especially at the testing phase where there is a rather small number of
documents.
Den söndagen den 2:e juni 2013 kl. 21:45:22 UTC+2 skrev Kya W:
Hi there!
I'm currently trying to use Elasticsearch in my thesis work, but
encountered a problem. If I use a term, for example "Monkey", which has 1
hit in my index... It returns this document 7 times. I use Jest together
with Elasticsearch since it was a bit easier to understand. I want every
document in my index to be returned maximum 1 time per search... not 7. I
would be very grateful for your help. I provide the code I have i my
"QueryManager" so far:
public class QueryManager {
private SearchSourceBuilder searchBuilder;
private JestClient client;
public QueryManager(JestClient client){
this.client = client;
searchBuilder = new SearchSourceBuilder();
}
public List<Documents> matches(String search){
Search search1 = new
Search(searchBuilder.query(QueryBuilders.multiMatchQuery(
search, //our search-term
"title", "content", "url") //searching in the fields title,
content and url
).toString());
search1.addIndex("data");
search1.addType("apa");
JestResult result;
try {
result = client.execute(search1);
List<Documents> documents =
result.getSourceAsObjectList(Documents.class);
//debug, return size of list
System.out.println(documents.size());
return documents;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Nooo \n");
return null;
}
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.