Skip to content

Not able to cache fqueries in a bool filter using Nest 1.0 #928

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

Closed
bittusarkar opened this issue Sep 6, 2014 · 1 comment
Closed

Not able to cache fqueries in a bool filter using Nest 1.0 #928

bittusarkar opened this issue Sep 6, 2014 · 1 comment

Comments

@bittusarkar
Copy link

I have a requirement of caching fqueries inside a bool should/must filter. Example: I want to produce the following ES query string using Nest. I've used term and wildcard queries simply as placeholders here. They can be any generic queries.

"filter": {
    "bool": {
         "must": [
            {
               "fquery": {
                  "query": {
                     "term": {
                        "field1": {
                           "value": "value1"
                        }
                     }
                  },
                  "_cache": true
               }
            },
            {
               "fquery": {
                  "query": {
                     "wildcard": {
                        "field2": {
                           "value": "value2"
                        }
                     }
                  },
                  "_cache": true
               }
            }
         ]
      }
   }

I could not find any Nest documentation around this and in Nest code I only found how to cache the entire bool query but not individual fqueries.

@Mpdreamz
Copy link
Member

Mpdreamz commented Sep 8, 2014

Hi @bittusrk I just committed some unit tests to showcase how you can build the desired json using NEST see:

https://github.com/elasticsearch/elasticsearch-net/blob/develop/src/Tests/Nest.Tests.Unit/Reproduce/Reproduce928Tests.cs

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

2 participants