i am using the 2.3.5 version elasticsearch ,this is the whole data:
==================================
{
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdNN3mqK8n_bRen0r",
"_score": 1,
"_source": {
"age": 325,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdOE-mqK8n_bRen0s",
"_score": 1,
"_source": {
"age": 335,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdMdjmqK8n_bRen0q",
"_score": 1,
"_source": {
"age": 35,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdJXLmqK8n_bRen0p",
"_score": 1,
"_source": {
"age": 25,
"about": "gasdf ghasd"
}
}
]
}
}
====================
when i am using java client api for searching:
QueryBuilder qb = QueryBuilders.termQuery("age","25");
SearchRequestBuilder builder = client.prepareSearch("testindex");
SearchResponse res = builder.setTypes("testtype").setQuery(qb).execute().actionGet();
SearchHits hits = res.getHits();
it returns only one hit that the age equal 25
but when i am using query dsl in head plugin:
{"query":{"term":{"age":"25"}}}
it returned all the document
"hits": {
"total": 4,
"max_score": 1,
"hits": [
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdNN3mqK8n_bRen0r",
"_score": 1,
"_source": {
"age": 325,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdOE-mqK8n_bRen0s",
"_score": 1,
"_source": {
"age": 335,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdMdjmqK8n_bRen0q",
"_score": 1,
"_source": {
"age": 35,
"about": "gasdf ghasd"
}
}
,
{
"_index": "testindex",
"_type": "testtype",
"_id": "AVvxdJXLmqK8n_bRen0p",
"_score": 1,
"_source": {
"age": 25,
"about": "gasdf ghasd"
}
}
]
}
am i using the wrong api??thx buddy