Filtering term with "_" doesn't work

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

What is your mapping for this field?

--
David Pilato - Developer | Evangelist

@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 6 mars 2015 à 13:27, João Lima joao.lima@betalabs.com.br a écrit :

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com?utm_medium=email&utm_source=footer.
For more options, visit https://groups.google.com/d/optout https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/57C846ED-2970-462A-ACCE-C11F82158FC0%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

"id_instancia": {
"type": "string",
"include_in_all": false
}

On Friday, March 6, 2015 at 9:29:21 AM UTC-3, David Pilato wrote:

What is your mapping for this field?

--
David Pilato - Developer | Evangelist
Elasticsearch.com http://Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr | @scrutmydocs
https://twitter.com/scrutmydocs

Le 6 mars 2015 à 13:27, João Lima <joao...@betalabs.com.br <javascript:>>
a écrit :

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/554effd6-d633-46ac-8af9-95088cda70de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I did something like this:

"mappings": {
"produto_cadastro": {
"properties": {
"id_instancia": {
"type": "string",
"include_in_all": false
}
}
}
}

On Friday, March 6, 2015 at 9:29:21 AM UTC-3, David Pilato wrote:

What is your mapping for this field?

--
David Pilato - Developer | Evangelist
Elasticsearch.com http://Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr | @scrutmydocs
https://twitter.com/scrutmydocs

Le 6 mars 2015 à 13:27, João Lima <joao...@betalabs.com.br <javascript:>>
a écrit :

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/47c6c7ba-fe84-4079-a454-2e1e224308f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Use a not analyzed field. You field is analyzed here with the standard analyzer.
Term filter compares the string you pass with the invented index.

Have a look at _analyze API as well. Should help to understand what happens.

David

Le 6 mars 2015 à 13:33, João Lima joao.lima@betalabs.com.br a écrit :

"id_instancia": {
"type": "string",
"include_in_all": false
}

On Friday, March 6, 2015 at 9:29:21 AM UTC-3, David Pilato wrote:
What is your mapping for this field?

--
David Pilato - Developer | Evangelist
Elasticsearch.com
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 6 mars 2015 à 13:27, João Lima joao...@betalabs.com.br a écrit :

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/554effd6-d633-46ac-8af9-95088cda70de%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/A0B6AFB5-796E-4759-BA05-F752F636F3B0%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Thanks David, I solved the problem.
The field was being analyzed, so I did this:
"mappings": {
"produto_cadastro": {
"properties": {
"id_instancia": {
"type": "string",
"index": "not_analyzed",
"include_in_all": false
}
}
}
}

And it worked perfectly.

http://www.betalabs.com.br/João Lima
joao.lima@betalabs.com.br joão.lima@betalabs.com.br
C. 11996609309 T.(11) 3522 6826
Rua Bandeira Paulista, 702, 12º andar - Itaim Bibi
04532-002 - São Paulo - SP - Brasil
www.betalabs.com.br | Curta betalabs | São Paulo SP
http://www.facebook.com/betalabsbr | Siga @betalabsbr
http://twitter.com/#!/betalabsbr
Esta mensagem contém informação confidencial, legalmente protegida e
destinada ao uso exclusivo da pessoa acima nomeada. Caso o leitor não seja
o seu destinatário, fica desde já notificado que a divulgação ou utilização
da mesma são estritamente proibidas. Se esta mensagem foi recebida por
engano, queira por favor nos informar imediatamente, respondendo este
e-mail.

This message transmission is intended only for the use of the addressee and
may contain confidential information. If you are not the intended
recipient, you are hereby notified that any use or dissemination of this
communication is strictly prohibited. If received in error, please notify
us immediately, by replying this message.

On Fri, Mar 6, 2015 at 10:53 AM, David Pilato david@pilato.fr wrote:

Use a not analyzed field. You field is analyzed here with the standard
analyzer.
Term filter compares the string you pass with the invented index.

Have a look at _analyze API as well. Should help to understand what
happens.

David

Le 6 mars 2015 à 13:33, João Lima joao.lima@betalabs.com.br a écrit :

"id_instancia": {
"type": "string",
"include_in_all": false
}

On Friday, March 6, 2015 at 9:29:21 AM UTC-3, David Pilato wrote:

What is your mapping for this field?

--
David Pilato - Developer | Evangelist
Elasticsearch.com http://Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr
https://twitter.com/elasticsearchfr | @scrutmydocs
https://twitter.com/scrutmydocs

Le 6 mars 2015 à 13:27, João Lima joao...@betalabs.com.br a écrit :

I'm trying to make a query like this:

{
"query" :{
"filtered" :{
"query" :{
"multi_match" : {
"query" : "Vonder Carregador de Baterias CBV 0900 - 110V",
"fields" : [ "nome^10", "descricao" ],
"operator" : "or"
}
},
"filter" : {
"bool" : {
"must" : [
{"term" : { "ativo" : 1 }},
{"term" : {"id_instancia": "Master_cleaner"}},
]
}
}
}
}
}
But when I filter some term with "_" it doesn't work.

--
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 elasticsearc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/
msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%
40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/481d9ee8-f5f0-43b2-a54d-06d9a6f25ae7%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/554effd6-d633-46ac-8af9-95088cda70de%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/554effd6-d633-46ac-8af9-95088cda70de%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the
Google Groups "elasticsearch" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/elasticsearch/rRgyD_hn8R8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/A0B6AFB5-796E-4759-BA05-F752F636F3B0%40pilato.fr
https://groups.google.com/d/msgid/elasticsearch/A0B6AFB5-796E-4759-BA05-F752F636F3B0%40pilato.fr?utm_medium=email&utm_source=footer
.

For more options, visit https://groups.google.com/d/optout.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAPiGn9ynKYEjuWS%3D7poLmWTB5z_Ks8f5%3DZWO%3DP8XrbfzWxAn9A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.