What's wrong with this query, it doesn't work if I only supply one character

Hi,

I imported a sample data:

{
"account_number": 0,
"balance": 16623,
"firstname": "Bradshaw",
"lastname": "Mckenzie",
"age": 29,
"gender": "F",
"address": "244 Columbus Place",
"employer": "Euron",
"email": "bradshawmckenzie@euron.com",
"city": "Hobucken",
"state": "CO"
}

Now, this query returns empty result (expected);

curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{ "match": { "age": "29" } }
],
"must_not": [
{ "match": { "city": "Hobucken" } }
]
}
}
}'

But if I replace the "city" part with "H" or "Ho" etc. It doesn't return
the expected empty result, why is that?

It only works with full word, why is that?

--
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/a8391d3b-0ed7-4eb6-9984-6f6fb9cf211e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Because of the analyzers used at index and search time.

May be this could help? http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/partial-matching.html http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/partial-matching.html

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet https://twitter.com/dadoonet | @elasticsearchfr https://twitter.com/elasticsearchfr | @scrutmydocs https://twitter.com/scrutmydocs

Le 21 janv. 2015 à 16:33, Aaron Lewis the.warl0ck.1989@gmail.com a écrit :

Hi,

I imported a sample data:

{
"account_number": 0,
"balance": 16623,
"firstname": "Bradshaw",
"lastname": "Mckenzie",
"age": 29,
"gender": "F",
"address": "244 Columbus Place",
"employer": "Euron",
"email": "bradshawmckenzie@euron.com",
"city": "Hobucken",
"state": "CO"
}

Now, this query returns empty result (expected);

curl -XPOST 'localhost:9200/bank/_search?pretty' -d '
{
"query": {
"bool": {
"must": [
{ "match": { "age": "29" } }
],
"must_not": [
{ "match": { "city": "Hobucken" } }
]
}
}
}'

But if I replace the "city" part with "H" or "Ho" etc. It doesn't return the expected empty result, why is that?

It only works with full word, why is that?

--
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/a8391d3b-0ed7-4eb6-9984-6f6fb9cf211e%40googlegroups.com https://groups.google.com/d/msgid/elasticsearch/a8391d3b-0ed7-4eb6-9984-6f6fb9cf211e%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/76B21350-99AC-43D0-B5EE-D232AE40FF53%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.