0 votes
1 view
in Web Technology by (11.2k points)

I have stored sentences in elasticsearch for autosuggestion.

format:

{

  "text": "what is temperature in chicago"

}

it suggests correctly when w or wha or what typed. but I am wondering if there is any way I can fetch most search sentences from elasticsearch.

1 Answer

0 votes
by (22.1k points)

Your request body should look something like this:

        {

            "query": {

                //your query

            },

            "aggs": {

                "common" : {

                    "terms" : { "field" : "text.keyword", "size": 20 }

                }

            }

        }

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...