I'm having an issue with Elastic Search queries in FusionAuth.
-
What is the best way to debug them?
-
It depends on the issue, but there are two things you can do. Note that FusionAuth typically sends the query you post to the
/api/user/search
endpoint with thequery
parameter straight through to ElasticsearchFirst, ensure you are running elasticsearch and not the database search engine.
Then, for some queries you can see the generate ElasticSearch query strings by clicking on the 'advanced' option in the user search area of the admin UI. This can be helpful.
Finally, try running the query directly against elasticsearch and seeing if it works. Here are examples which will pull back all the data in your elasticsearch cluster (beware!).
curl -XPOST -H 'Content-type: application/json' "http://localhost:9021/_search" -d' { "query": { "match_all": {} } }'
or, if you have the query stored in
query.json
curl -XPOST -H 'Content-type: application/json' "http://localhost:9021/_search" -d@query.json