Filters and wildcards

Hello,

I have another probably newbie question. I would like to achieve something
like the following:

{
"size": "20",
"query": {
"filtered": {
"query": {"match_all": {}},
"filter": {
"and": [
{"term": {"Fields.FieldName": "contentbody"}},
{"wildcard": {"Fields.Value": "direct*"}}

          ]
       }
    }
}

}

where I am looking for all fields of contentbody having direct as a partial
starting match.

Needless to say, out of the box, this query returns a 500 error stating No
filters for wildcard are registered.

As the documents are somewhat dynamic in nature, my hope was to avoid
specific mappings for the documents, but adding special config for wildcard
filters is well within reason.

Thank you

--

You can use a QueryFilter to wrap your wildcard query, can't you?
Or a prefixFilter ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 nov. 2012 à 18:43, Rjoys rjoys@snapflow.com a écrit :

Hello,

I have another probably newbie question. I would like to achieve something like the following:

{
"size": "20",
"query": {
"filtered": {
"query": {"match_all": {}},
"filter": {
"and": [
{"term": {"Fields.FieldName": "contentbody"}},
{"wildcard": {"Fields.Value": "direct*"}}

          ]
       }
    }
}

}

where I am looking for all fields of contentbody having direct as a partial starting match.

Needless to say, out of the box, this query returns a 500 error stating No filters for wildcard are registered.

As the documents are somewhat dynamic in nature, my hope was to avoid specific mappings for the documents, but adding special config for wildcard filters is well within reason.

Thank you

--

The prefixFilter did the trick! Thank you.

I simply had to reconstruct my query builder to support exact matches
versus "starts with"

On Tuesday, November 13, 2012 11:37:41 AM UTC-8, David Pilato wrote:

You can use a QueryFilter to wrap your wildcard query, can't you?
Or a prefixFilter ?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 13 nov. 2012 à 18:43, Rjoys <rj...@snapflow.com <javascript:>> a
écrit :

Hello,

I have another probably newbie question. I would like to achieve something
like the following:

{
"size": "20",
"query": {
"filtered": {
"query": {"match_all": {}},
"filter": {
"and": [
{"term": {"Fields.FieldName": "contentbody"}},
{"wildcard": {"Fields.Value": "direct*"}}

          ]
       }
    }
}

}

where I am looking for all fields of contentbody having direct as a
partial starting match.

Needless to say, out of the box, this query returns a 500 error stating No
filters for wildcard are registered.

As the documents are somewhat dynamic in nature, my hope was to avoid
specific mappings for the documents, but adding special config for wildcard
filters is well within reason.

Thank you

--

--