The above command returns results when submitted from a Phython program as follows:
elastic_query = es.search(index='fborep',body={"size":1000,"query":{"bool":{"must":[{"wildcard":{"DESC":"post traumatic stress disorder"}}]}}})
When the browser command is run it returns size= records from the database but not any that contain "post traumatic stress disorder" in the DESC field.
The reason you're seeing all the results is because Elasticsearch didn't know what to do with the invalid search request, so it just executed a "Match Everything" search, which returns all your records
I'd recommend starting at the beginning of the Definitive Guide and working through some of the intro chapters about search, it'll help a bunch with understanding how ES works
Isn’t this also a JSON body search? I do seem to remember reading somewhere that one could do this.
We were wanting to submit url queries directly to the browser via C# code and that has been successful with the above query.
Yeah, that's not valid either. See URI Search for details.
At one point in the distant past, you could URLencode the JSON and put it in a "source" param, but I'm not sure if this is supported anymore. And it's bad practice, since JSON DSL queries can get quite long but URIs have a fixed length limit
To clarify, you need to put the JSON in the HTTP request body, which means you can't execute it directly from the browser's URL bar. You'll need something like Sense, Postman extension, curl, etc which can send HTTP requests with bodies
The query I sent to you has been working from both the url directly and also from our logic that places it into the
body before submitting it. I use the url directly to debug my queries before I place them into code but it sounds like
this isn’t a very good idea from what you say regardless that it has “worked so far”. It won’t some day.
I’ll have to go back and debug from my code for now.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.