Querying array of strings (multiword) with AND operator

Hi,

I really don't know what's wrong, but I seem to be unable to find a way of
querying array elements that contain multiple words with "AND" operator.

ES version: 1.3.*,
only the default standard analyser in use

A dummy document

POST /dummy/location
{
"locationArray" : ["United Kindgom", "London"],
"location" : "United Kingdom"
}

It's mapping

GET /dummy/_mapping
{
"dummy": {
"mappings": {
"location": {
"properties": {
"locationArray": {
"type": "string"
},
"location": {
"type": "string"
}
}
}
}
}
}

Query that matches "location" field OK:

GET /dummy/_search
{
"query": {
"match": {
"location" : {
"query" : "United Kingdom",
"operator" : "AND"
}
}
}
}

Problematic query that returns no results trying to match "locationArray"
field:

GET /dummy/_search
{
"query": {
"match": {
"locationArray" : {
"query" : "United Kingdom",
"operator" : "AND"
}
}
}
}

I'd really appreciate a hint - there must be something obvious i'm missing
/ not know about when querying that array field.

Cheers

--
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/4179ca35-e376-471a-9228-1bf69b0bf550%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

You have a typo:

POST /dummy/location
{
"locationArray" : ["United Kindgom", "London"],
"location" : "United Kingdom"
}

and I'm sure you mean

POST /dummy/location
{
"locationArray" : ["United Kingdom", "London"],
"location" : "United Kingdom"
}

Jörg

On Sun, Dec 14, 2014 at 12:57 PM, Mathew Bolek borska.petra@gmail.com
wrote:

Hi,

I really don't know what's wrong, but I seem to be unable to find a way of
querying array elements that contain multiple words with "AND" operator.

ES version: 1.3.*,
only the default standard analyser in use

A dummy document

POST /dummy/location
{
"locationArray" : ["United Kindgom", "London"],
"location" : "United Kingdom"
}

It's mapping

GET /dummy/_mapping
{
"dummy": {
"mappings": {
"location": {
"properties": {
"locationArray": {
"type": "string"
},
"location": {
"type": "string"
}
}
}
}
}
}

Query that matches "location" field OK:

GET /dummy/_search
{
"query": {
"match": {
"location" : {
"query" : "United Kingdom",
"operator" : "AND"
}
}
}
}

Problematic query that returns no results trying to match "locationArray"
field:

GET /dummy/_search
{
"query": {
"match": {
"locationArray" : {
"query" : "United Kingdom",
"operator" : "AND"
}
}
}
}

I'd really appreciate a hint - there must be something obvious i'm missing
/ not know about when querying that array field.

Cheers

--
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/4179ca35-e376-471a-9228-1bf69b0bf550%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/4179ca35-e376-471a-9228-1bf69b0bf550%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/CAKdsXoFAPG66R6CbKz4q7Y4yNb3svEN_DThXv88GkAj16yMnSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.