Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ametad opened this issue Jun 14, 2018 · 1 comment
Open

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

ametad opened this issue Jun 14, 2018 · 1 comment

Comments

@ametad
Copy link

ametad commented Jun 14, 2018

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
Copy link
Author

ametad commented Jun 18, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant