W
W
WebDev2017-02-07 10:28:37
elasticsearch
WebDev, 2017-02-07 10:28:37

How to make elasticsearch work correctly?

I'm trying to deal with ES, installed it, created a document with one name field. Filled out.
I'm trying to make a request like this:

http://localhost:9200/idx/artists/_search?q=name:system&sort=name:asc&size=20

That is, I'm looking for records by the value "system".
I get this result:

009 Sound System
System 7
System 84
System of a Down
Abhorrent System
Afro Celt Sound System
Alif Sound System
System and Station
Fear and the Nervous System
Sex and Sound System
Anima Sound System
CANS Central Asian Nervous System
Attention System
SELL SYSTEM BAND
Basement Sound System
Dynamik Bass System
Wicked Beat Sound System
Belgradeyard Sound System
Black Rose Sound System
Kid Blast Sound System

And I expect to see first groups that begin with the word system, but I get it is not clear what. How to sort the results? And how does ES sort them by default?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim Stepanov, 2017-02-09
@Vdm17

Most likely ES performed a standard search using Term Query. In this case, no sorting occurs except by "score" (relevance).
For your case, you should rather use
Prefix Query - https://www.elastic.co/guide/en/elasticsearch/refe...
or
Match Phrase Prefix Query - https://www.elastic.co/guide/en/ elasticsearch/ref...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question