Analysis of search query VS hits? Identifying the missing terms?


(Paul H) #1

I've got a match query I allow for a minimum match of "1<-1 6<-2" so the user can search for say: "dark souls 3" they'll get document results for "dark souls" or "dark souls 2". Is there any way via the ES response that I can capture what terms did not match? e.g. a hit of "dark souls" could express that "3" was not found?


(Mark Harwood) #2

Check out named queries
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-named-queries-and-filters.html


(Paul H) #3

What I'm seeing that do is just tell me the name of the root boolean query (which is always present). I'm looking more for a breakdown of the analyzed search terms.


(Mark Harwood) #4

So you'll need to tokenize the query string in your client (you can use the _analyze api to do this) and formulate a bool query with named child clauses containing these tokens.
Ugly but the only way I can see of doing this.


(Paul H) #5

I see! It does get ugly but I think my particular environment works. (I already was doing an _analyze as I needed a token count from the search string).

Interesting trivia (didn't hold me up) that I learned while implementing: In a Nested query, the child clauses albeit named were not returned.


(system) #6

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