I need some help please, to write a correct Match_all Search Query to match all things inside my Index in Elasticsearch. I am using Elasticsearch 6.3.1. and Java 8.
I want to translate this Query in Java Low Level Rest Client API.
GET try1/_search
{
"query": {
"match_all": {}
}
}
I tried something like this below, and it gives me nothing from the Index. I do now know where to put my Index name to search below,
SearchRequestBuilder sr = new SearchRequestBuilder(client, SearchAction.INSTANCE)
.setSearchType(SearchType.DFS_QUERY_THEN_FETCH)
.setQuery(QueryBuilders.matchAllQuery());
the Code above returns me this, which is not the Index Content,
{"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}}}}