Hi everyone,
I'm just discovering elasticsearch this week and i would like to replace in
my company a DB2 search with elasticsearch capabilities.
I insert 1 million personn in a signe node.
When i user rest api (calling
http://localhost:9200/personne/_search?q=prenom:clarence&pretty=true URL) ,
i obtain the following results :
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 1977,
"max_score" : 7.3687563,
"hits" : [ {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "GGBxRnJVS1mT6SvJxCGmmQ",
"_score" : 7.3687563, "_source" : {"nom":"Ford","prenom":"Clarence","codePostal":8323,"pays":"FRANCE","dateNaissance":"1960-02-01T00:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "7oemmrCnSqqNA7FbM7VM1Q",
"_score" : 7.3687563, "_source" : {"nom":"Allen","prenom":"Clarence","codePostal":49299,"pays":"FRANCE","dateNaissance":"1981-04-26T23:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "-So1k6tDT0Gnoy3mlG_KhA",
"_score" : 7.3687563, "_source" : {"nom":"Serrano","prenom":"Clarence","codePostal":57311,"pays":"FRANCE","dateNaissance":"1983-07-24T23:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "V_YfrN3tSUmTs0ryXtMFiw",
"_score" : 7.3687563, "_source" : {"nom":"McFarland","prenom":"Clarence","codePostal":67063,"pays":"FRANCE","dateNaissance":"1981-09-03T23:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "74_Q17zFRhWCaQR4xdrhtQ",
"_score" : 7.3687563, "_source" : {"nom":"Clark","prenom":"Clarence","codePostal":45505,"pays":"FRANCE","dateNaissance":"1966-04-16T00:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "CY8262_BR3SzA5Eptpk7GA",
"_score" : 7.3687563, "_source" : {"nom":"Simon","prenom":"Clarence","codePostal":79043,"pays":"FRANCE","dateNaissance":"1966-01-08T00:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "RdhvKLpYQWulUYoRWSxeuQ",
"_score" : 7.3687563, "_source" : {"nom":"Fuller","prenom":"Clarence","codePostal":74665,"pays":"FRANCE","dateNaissance":"1962-03-03T00:00:00.000Z"}
}, {
"_index" : "personne",
"_type" : "personnephysique",
"_id" : "kvHP94hMQu-8Ur4sdkFSXQ",
"_score" : 7.3687563, "_source" : {"nom":"Dawson","prenom":"Clarence","codePostal":18510,"pays":"FRANCE","dateNaissance":"1964-05-23T00:00:00.000Z"}
}, {
...
When i do the same search with java client with the following code :
node = NodeBuilder.nodeBuilder().node();
Client client = node.client();
SearchResponse response = client.prepareSearch("personne")
.setSearchType(SearchType.QUERY_AND_FETCH)
.setQuery(termQuery("prenom", "Clarence"))
.setFrom(0).setSize(10).setExplain(true)
.setScroll(new TimeValue(600000))
.execute()
.actionGet();
System.out.println(response.toString());
i got 0 result :
{
"_scroll_id" :
"cXVlcnlBbmRGZXRjaDs1OzYyNzpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYzMDpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyOTpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyODpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzYyNjpXeG9pQWc3OFRPSzNVeldyUTJUa0lROzA7",
"took" : 17,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 0,
"max_score" : null,
"hits" : [ ]
}
}
Did i miss something ?
Thanks for your answer