Must include query Json payload for ElasticSearch


I have a database where I want to see which countries an organization exists in (one organization can exist in multiple countries like USA and Mexico). What would the correct Json syntax be if I wanted to see organizations that exist in USA but can exist in other countries as well?

When I execute the query:
GET iorganization/_search
"query": {
"bool": {
"must": [
{"match" : {"Countries" : "USA"}}

I get only results where the organization exists exclusively in USA so I am omitting countries that exist in USA among others.

What's the right way to do this?



Could you provide a full recreation script as described in About the Elasticsearch category. It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

For example how your documents look like?

It turns out that the bool query does return results where USA can be one of many countries, but the relevance score is highly weighted towards results where USA is the only/one of the few countries. This problem was created by mistake. Thanks for your help and I apologize about that.

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