basemkhirat / elasticsearch

The missing elasticsearch ORM for Laravel, Lumen and Native php applications
MIT License
401 stars 130 forks source link

Question about ->where('attributeName', true) #89

Open ametad opened 6 years ago

ametad commented 6 years ago

In my Elasticsearch index there is this mapping:

                    "attributeName": {
                        "type": "boolean"
                    },

Elasticsearch 5

In version 5 I can do a search like:

// Search for data where 'attributeName' is set to true.
ModelName::where('attributeName', 1)->get();

This is working great!

Elasticsearch 6

But In version 6 when I do a search like:

// Search for data where 'attributeName' is set to true.
ModelName::where('attributeName', 1)->get();

That doesnot work....
After some testing, I found out the following does work:

// Search for data where 'attributeName' is set to true.
ModelName::where('attributeName', 'true')->get();

Please notice the string 'true' instead of a php boolean true.

Question

Is it intended to de a search for a boolean type like so:

ModelName::where('attributeName', 'true')->get();
ModelName::where('attributeName', 'false')->get();

Perhaps you can point me in the right direction?

ametad commented 6 years ago

Trying to be as thorough as possible, and as clear as possible:

// Search for data where 'attributeName' is set to true.
ModelName::where('attributeName', 'true')->get();

// Search for data where 'attributeName' is set to false.
ModelName::where('attributeName', 'false')->get();
// This does return all models where 'attributeName' is set to boolean false in the Elasticsearch index.