I'm working on integration elasticsearch into an application we are building. I run into trouble with nested queries and filters. Here's an example of our mapping:
"index": {
"mappings": {
"users": {
"properties": {
"membership": {
"type": "nested",
"properties": {
"membership": {
"type": "string"
},
"start date": {
"type": "date"
},
"end date date": {
"type": "date"
}
}
}
}
}
}
}
Now, i want to find all users with "membership" "foo bar", without an enddate. The problem is that when i use a standard analyzer, "foo bar" is split into two words in the index, so i can't use the term filter to look for "foo bar". We can solve this by using a different analyzer, but this has other disadvantages, like problems with upper/lowercases, etc.
Besides: it's quite easy to find everyone with a "foo bar" membership by using a query instead of a filter. The problem is that there is no query to find nested documents with "End date" = missing. There is a filter for this, but i can't seem to be able to combine the query "membership" = "foo bar" with the filter "end date" = missing, within the same nested document.
So, i can find everyone with "end date" = missing and i can find everyone with membership "foo bar", but not everyone with no end date specificaly for membership "foo bar".
Are there any suggestions on how to solve this problem?