Need help with match query

Hi,

I need to match an analyzed string in Elasticsearch but couldnt find a way to do it.
The case is ;

Doc 1           Doc 2           QueryString
-----------   ----------     -----------------
a                a                   a
b                b                   b
c                c                   c
d                e                   d
                                     g

How can i get Doc 1 with Match Query in this case ? Or any other suggestion please. Thank you

Hey,

you might want to take a look at the match query in combination with minimum_should_match - make sure you take some time to read it though.

See
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-match-query.html
https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-minimum-should-match.html

--Alex

Hey Alex,

Actually i red minimum_should_match and i red again when you said :slight_smile: But in this case, think that a,b,c,d,e & g is dynamic. So i cant decide which one is required. Am i missing something ? Or should i try something else?

Hey,

you have not mentioned at all what you tried.. in the above case setting minimum should match to 80% should work.

--Alex

Hey,

Sorry bothering you but the last thing that i didnt mention is Querystring can have more than 5 and docs also can have variables in different numbers. So i think 80% minimum should match wouldnt work

I am doing something wrong this is what i need to solve,

Doc 1 and Doc 2 have different numbers of variables, when i query on them with Match query the only thing i want to get that matches the **most** with QueryString.

Doc 1           Doc 2           QueryString
-----------   ----------     -----------------
a                a                   a
b                b                   b
c                c                   c
d                e                   d
r                v                   g
                 z                   e
                ...                  f
                                    ...

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