Skip to content

Add search_after parameter to new terms_enum api #72910

@markharwood

Description

@markharwood

To allow client applications to page through many autocomplete suggestions we should offer a search_after parameter. Calling applications would pass the last term value from the previous set of results and the returned results would be all those matching the provided prefix string param but after the supplied search_after parameter. An example might be:

Request 1

localhost:9200/myindex/_terms_enum
{
"field" : "url",
"string" : "www."
}}

Result 1

{
   "terms": [
    "www.aa.com",
    "www.abc.com",
    ...
    "www.bbc.com"
    ]

Request 2 (with new search_after param)

localhost:9200/myindex/_terms_enum
{
"field" : "url",
"string" : "www.",
"search_after" : "www.bbc.com"
}}

Result 2

{
   "terms": [
    "www.breitling.com",
    "www.bt.com",
    ...
    "www.cnn.com"
    ]

It would be a client error to pass a search_after string that does not start with the provided string prefix.

Example invalid request that would produce an error

   "search_after": "www.bbc.com",
   "string": "some_other_prefix"

Related to #71550

Metadata

Metadata

Assignees

Labels

:Search/SearchSearch-related issues that do not fall into other categories>enhancementTeam:SearchMeta label for search team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions