N
N
Narek2017-04-06 12:52:18
elasticsearch
Narek, 2017-04-06 12:52:18

How to write an aggregate query?

We have a name "Connexium 14TX/2 Budget Switch".
the user enters the word "Switch" in the search bar,
we give him in response not a list of everything that includes the word switch, but such a list:
Switch (15236 positions)
Connexium switch (1245 positions)
Figexium switch (1457 positions)
Budget switch (11 positions)
Connexium 14TX/2 switch (6 positions)
and so on in the list clusters with the occurrence of the word switch

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Stepanov, 2017-04-13
@Vdm17

And how does ElasticSearch know that the phrase "Connexium 14TX / 2 low-cost switch" should be divided into several options with a search of words, and each time "Switch" should be at the beginning?
Alternatively, try manually generating query options. For example, for the phrase you provided, you should get an additional field with an array:
["Switch", "Connexium Switch", "Low-end Switch", "Connexium 14TX / 2 Switch"]
And already on this field it will be possible to write aggregation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question