How to exclude the particular type in search

Hi there,
I do fave a case, where i do have almost 50 types in one
index, i want all those types to be searchable in the search, but not some
particular two types, so i think including all that 48 types will not be a
good idea.so can anyone give me the alternative to exclude those 2 types
from the search.

There isn't an option to exclude types, just include them. The types filter
can potentially have excludes aspect to it, you can open an issue, but for
now, you will have to list the full 48.

On Sat, Dec 10, 2011 at 8:50 AM, Narinder Kaur narinder.kaur@izap.inwrote:

Hi there,
I do fave a case, where i do have almost 50 types in one
index, i want all those types to be searchable in the search, but not some
particular two types, so i think including all that 48 types will not be a
good idea.so can anyone give me the alternative to exclude those 2 types
from the search.

On Sat, 2011-12-10 at 18:31 +0200, Shay Banon wrote:

There isn't an option to exclude types, just include them. The types
filter can potentially have excludes aspect to it, you can open an
issue, but for now, you will have to list the full 48.

Wouldn't this work?

curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"not" : {
"or" : [
{
"type" : {
"value" : "type_1"
}
},
{
"term" : {
"_type" : "type_2"
}
}
]
}
},
"query" : {
"text" : {
"foo" : "bar"
}
}
}
}
}
'

Yes :slight_smile:

On Mon, Dec 12, 2011 at 12:10 PM, Clinton Gormley clint@traveljury.comwrote:

On Sat, 2011-12-10 at 18:31 +0200, Shay Banon wrote:

There isn't an option to exclude types, just include them. The types
filter can potentially have excludes aspect to it, you can open an
issue, but for now, you will have to list the full 48.

Wouldn't this work?

curl -XGET 'http://127.0.0.1:9200/_all/_search?pretty=1' -d '
{
"query" : {
"filtered" : {
"filter" : {
"not" : {
"or" : [
{
"type" : {
"value" : "type_1"
}
},
{
"term" : {
"_type" : "type_2"
}
}
]
}
},
"query" : {
"text" : {
"foo" : "bar"
}
}
}
}
}
'

Thanks so much, hope it will help.