How to increase response size in elasticsearch with spring-data using @Query annotation?

0

Currently the below query is only returning 10 search hits. I want to increase it to 100. How to do it??

    @Query("{\"match\": {\"metaData.transcript1\": {\"query\": \"?0\",\"fuzziness\": \"AUTO\",\"prefix_length\": \"0\",\"max_expansions\": \"100\",\"boost\": \"1.0\"}}}")
    @Highlight(fields = {@HighlightField(name = "metaData.transcript1")}, parameters = @HighlightParameters(
            preTags = "<em>",
            postTags = "</em>",
            fragmentSize = 50
            numberOfFragments = 3
        ))
    List<SearchHit<Audio>> findByKeyword(String query);```
elasticsearch java java-8 spring
2021-11-23 13:54:48
1

1

Try with Page

  @Query("{\"match\": {\"metaData.transcript1\": {\"query\": \"?0\",\"fuzziness\": \"AUTO\",\"prefix_length\": \"0\",\"max_expansions\": \"100\",\"boost\": \"1.0\"}}}")
    @Highlight(fields = {@HighlightField(name = "metaData.transcript1")}, parameters = @HighlightParameters(
            preTags = "<em>",
            postTags = "</em>",
            fragmentSize = 50
            numberOfFragments = 3
        ))
    Page<SearchHit<Audio>> findByKeyword(String query,Pageable pageable);

and use like it

Page<SearchHit<Audio>> audios = repository.findAll("query_string",PageRequest.of(0, 100));
2021-11-23 14:03:33

SearchHit doesn't work with Page... Got this Exception: org.springframework.data.elasticsearch.NoSuchIndexException: Index [SearchHit] not found.; nested exception is [SearchHit] ElasticsearchStatusException[Elasticsearch exception [type=index_not_found_exception, reason=no such index [SearchHit]]]
Ajay Rajpurohit

Gianluca Musa

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................