Hello folks,
i need some help please , to write a correct Search Query to match all things inside my Index in Elasticsearch .
I want also to translate this Query in Java Low Level Rest Client API.
GET try1/_search
{
"query": {
"match_all": {}
}
}
I tried something like this bellow , and it gives me nothing from the Index.
I do now know where to put my Index name to search bellow,
SearchRequestBuilder sr = new SearchRequestBuilder(client, SearchAction.INSTANCE)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.matchAllQuery());
the Code above returns me this ,
{"query":{"match_all":{"boost":1.0}}}
I tried this too , and did not work, bellow ,
SearchRequest searchRequest = new SearchRequest("try1");
SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
searchSourceBuilder.query(QueryBuilders.matchAllQuery());
searchRequest.source(searchSourceBuilder);
the Result is ,
{searchType=QUERY_THEN_FETCH, indices=[try1], indicesOptions=IndicesOptions[id=38, ignore_unavailable=false, allow_no_indices=true, expand_wildcards_open=true, expand_wildcards_closed=false, allow_aliases_to_multiple_indices=true, forbid_closed_indices=true, ignore_aliases=false], types=[], routing='null', preference='null', requestCache=null, scroll=null, maxConcurrentShardRequests=0, batchedReduceSize=512, preFilterShardSize=128, allowPartialSearchResults=null, source={"query":{"match_all":{"boost":1.0}}}}
Can Anybody please help me to write the Search Query to match_all in the right way using Low Level Client Rest API ???
thx.