Reputation: 93
I have a filter query as shown below. I intend to filter on stripped-blocked-uri (exact match) which is not working,
{
"query": {
"bool": {
"filter": [
{
"term": {
"stripped-blocked-uri": "https://www.twitter.com:9090"
}
},
{
"term": {
"project-id": "1"
}
},
{
"term": {
"rule-id": "101"
}
}
]
}
}
}
which is returning no hits.
My mapping is,
"stripped-blocked-uri": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
Not sure what is going wrong here. Please help!
Upvotes: 0
Views: 108
Reputation: 16933
Use the keyword
field:
{
"query": {
"bool": {
"filter": [
{
"term": {
"stripped-blocked-uri.keyword": "https://www.twitter.com:9090"
}
},
{
"term": {
"project-id": "1"
}
},
{
"term": {
"rule-id": "101"
}
}
]
}
}
}
Upvotes: 1