# Regexp "intersection" matching nothing

**URL:** <https://discuss.elastic.co/t/regexp-intersection-matching-nothing/17004>\
**Category:** Elasticsearch\
**Created:** [April 14, 2014, 2:32pm UTC](https://discuss.elastic.co/t/regexp-intersection-matching-nothing/17004 "2014-04-14T14:32:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![petchemaite](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@petchemaite](https://discuss.elastic.co/u/petchemaite)\
**Post date:** [April 14, 2014, 2:32pm UTC](https://discuss.elastic.co/t/regexp-intersection-matching-nothing/17004/1 "2014-04-14T14:32:04Z")

</div>

```
     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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/dab140c0-c8c3-4122-ab6b-4c86df9ef9f0%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/dab140c0-c8c3-4122-ab6b-4c86df9ef9f0%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![petchemaite](https://avatars.discourse-cdn.com/v4/letter/p/e68b1a/32.png) [@petchemaite](https://discuss.elastic.co/u/petchemaite)\
**Post date:** [April 15, 2014, 7:13am UTC](https://discuss.elastic.co/t/regexp-intersection-matching-nothing/17004/2 "2014-04-15T07:13:19Z")

</div>

Ok, sorry for the noise, regexp filter simply doesn't seem to like analyzed  
fields...

--  
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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/bb6452e8-2036-443b-ac01-44ef7c3a5804%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/bb6452e8-2036-443b-ac01-44ef7c3a5804%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:35am UTC](https://discuss.elastic.co/t/regexp-intersection-matching-nothing/17004/3 "2017-07-06T01:35:52Z")

</div>


