I created a collection and indexed the field as "text" in mondo shell. Then I query documents with the following parameters:
localhost:8080/db/tags?filter={"$text":{"$search":"some text"}}
and get error:
http status code 500
http status description "Internal Server Error"
message "Query failed with error code 2 and error message 'Too many text expressions' on server 127.0.0.1:27017"
But in mongo shell everything is OK. I got the rigth response on this query:
db.tags.find({"$text":{"$search":"some text"}})
What's wrong? I did everything by these tutorials:
https://docs.mongodb.com/manual/reference/operator/query/text/#text-query-examples
I'd suggest to re-create the index with RESTHeart instead of Mongo shell.
First, delete the index with the shell, then create it again by following the examples at: https://restheart.org/learn/indexes/
For example, you can create a named index for the collection
tags
with the following:Then please let us know if it works.
Updated:
Here what I did to successfully test a full text search on RESTHeart (BTW I'm using the httpie client, but curl would work similarly):
docker-compose up
Then issue the following commands:
Creare a db
http -a admin:changeit PUT http://localhost:8080/mydb
Create a collection
http -a admin:changeit PUT http://localhost:8080/mydb/sample
POST sample documents
http -a admin:changeit POST http://localhost:8080/mydb/sample < sample.json
Create a collection index named "about" which uses the "about" element in JSON documents for text indexing and searching
http -j -a admin:changeit PUT http://localhost:8080/mydb/sample/_indexes/about keys:='{"about":"text"}}'
Check the index
http -a admin:changeit GET http://localhost:8080/mydb/sample/_indexes
Perform successful full text search
http -a admin:changeit GET http://localhost:8080/mydb/sample?filter='{"$text":{"$search":"\"Consequat fugiat commodo irure\""}}'
You'll find the sample.json.zip file in attachment.
I'd suggest to compare the above steps with what you are doing and see if there are remarkable differences.