Getting Search suggestion from secondary field

Please sugest a way where we can provide user with suggestion from second field other then the matchin field


[Name ] [Address] [Phone no]
Pooja Tower , Gopalpura mode Jaipur , xxxxxxxxx
Balaji Hotel , vaishali nagar jaipur , xxxxxxxxx

when we type 'pooj' we are getting match as pooja tower but it is hard to find which pooja tower as there could be N number. Thus we need suggestions like

Pooja tower , Gopalpura mode , jaipur

This way user will get an idea of place with the address.

Note. Tried mergeing two column into one with comma seprated but getting suggestions like

pooja tower
pooja tower gopalpura
pooja tower gopalpura mode
pooja tower gopalpura mode jaipur

Thanks for the help

hey @Himanshu_Jain3

Are you using Search UI autocomplete configuration? If so, could you share your configuration please?

What you request isn't possible with suggestions type but is possible with result suggestions type as the result suggestion is a full hit result so the change would be to adjust the secondary fields ( address and phone number) to show in the autocomplete.


1 Like

Hello Joseph

Thanks for the help. As I am new to this Elasticsearch World could you a better example base documentation other then results query suggestion documentation.

So I beleive that we can get search as you type suggestion from primary field with data from secondary field at suffix.

This way user will get more idea about primary field.

Please explain in laymen terms how we could achieve that. That would be a great help.


So if you're using App Search and Search UI, this code below should be similar for SearchBox:

    linkTarget: "_blank",
    sectionTitle: "Results",
    titleField: "contactInformation", // the field just to present the result
    urlField: "nps_link",
    shouldTrackClickThrough: true,
    clickThroughTags: ["test"]

Now see the titleField property, thats the field you specify to display the result. In this example its title but you could create a new field (for example contactInformation) which contains "[Name] [Address] [Phone no]". That field contents will be present when matches in the autocomplete results are shown.

Hope this helps.

1 Like

This is cool will try and update. Thanks for the Help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.