Hi all,

First, some problem background, I'm trying to search a list of words in a 
field that usually contains a list of string. All provided words must be 
present.

If I'm using a match query filter with operator AND, I get all the 
documents whose field contain all the provided words, but not necessarily 
within a single string.

  "filter": {
    "fquery": {
      "query": {
        "match": {
          "fieldname": {
            "query": "word1 word2",
            "type": "boolean",
            "operator": "AND"
          }
        }
      },
      "_cache": true
    }
  }

Standard way of solving this problem is, I assume, turning this field into 
a nested document; But since supporting nested documents will require 
significant development I'm looking for a stopgap measure.
I've been trying to filter out "false positives" by ANDing a regexp filter 
to the existing match query filter:

  "filter": {
    "and": {
      "filters": [
        {
          "fquery": {
            "query": {
              "match": {
                "fieldname": {
                  "query": "word1 word2",
                  "type": "boolean",
                  "operator": "AND"
                }
              }
            },
            "_cache": true
          }
        },
        {
          "regexp": {
            "fieldname": {
              "value": "@word1@&@word2@"
            }
          }
        }
      ]
    }
  }

Problem is, as soon as I use "&" in the regular expression, I do not get 
any hit; Explicitly setting regexp flags to ALL or some combination 
involving INTERSECTION does not help.
Did I miss something, or can somebody confirm the issue?
This is with Elasticsearch 1.0.1.

Regards,
Pierre.

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/dab140c0-c8c3-4122-ab6b-4c86df9ef9f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to