Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Query with Contains and AND/OR generates invalid query #42

Closed
damieng opened this issue Oct 10, 2014 · 1 comment
Closed

Query with Contains and AND/OR generates invalid query #42

damieng opened this issue Oct 10, 2014 · 1 comment
Labels

Comments

@damieng
Copy link
Member

damieng commented Oct 10, 2014

Normally Or and And queries put the two operations inside an Or or And criteria. This is not valid where the criteria is the special QueryString operation:

context.Query<Product>().Query(g => g.name.Contains("a") && g.reorderLevel > 1);
{
  "query": {
    "and": [
      {
        "query_string": {
          "query": "*a*",
          "fields": [
            "name"
          ]
        }
      },
      {
        "range": {
          "reorderLevel": {
            "gt": 1
          }
        }
      }
    ]
  }
}

We should detect this and throw a better error message that indicates for an AND the condition should be moved to the filter via Where. OR is not possible.

@damieng damieng added the bug label Oct 10, 2014
@damieng damieng added this to the 1.2 milestone Oct 10, 2014
@damieng damieng removed this from the 1.2 milestone Nov 21, 2014
@damieng
Copy link
Member Author

damieng commented Dec 1, 2014

Duplicate underlying cause as #37

@damieng damieng closed this as completed Dec 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant