Full Text Search query with spaces

I have set up FTS on my buckets and when trying to search for queries that have spaces, I’ve found it returns more than what I want.

Here is an example:
On an index I search the following: “+field: Key Word”. What I want it to return is any document in that bucket that contains “Key Word” exactly in the field “field”, however it returns documents that have just “Key” or “Word” or “Key Word” in the field “field”, which is not what I want to return.

Any ideas if this is possible or a different way to do this?
Thank you

Hi Jacob,
There are a few things that might be happening. To start out, I would suggest you check what analyzer are you using to make sure it’s handling spaces the way you want. Secondly, how are you performing the search? Is this a query string query or another type of query?

In full text search, the document text gets analyzed when you create the index, and part of the analysis is to break up the input text into tokens. Then, when you search, you need to use the same analyzer on your search query text so that the tokens you look for are the same as the ones that are in the index.

You can play with the bleve analyzers here:

(Warning - for some reason, when I use that in Chrome sometimes the dropdown menu doesn’t work for me. I don’t know why).

If you pick the ‘keyword’ analyzer, it will take the entire string, spaces and all, as a single token. You can also try custom and then play with individual tokenizers, etc.

If you can’t figure out the problem using that analysis link, feel free to share your index definition JSON and your query JSON, and I can take a look at them.