Multi_match query and match _all returns different set of results

Hi there,

I need to search in multiple fields where I do not know field names in
advance, so I can't use multi_match syntax. So I found, that _all field
aggregates all fields set to be included in all in mapping. Unfortunately
it returns different result set, that multi_match. Here is complete test
set for Sense.

What I'm doing wrong?

thank you for any response.

Delete the my_index index

DELETE /my_index

Create my_index with a single primary shard

and set up the autocomplete analyzer using

edge ngrams

PUT /my_index
{
"settings": {
"number_of_shards": 1,
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": 1,
"max_gram": 20
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"autocomplete_filter"
]
}
}
}
}
}

Map the name and desc field to use the autocomplete analyzer

PUT /my_index/_mapping/mytype
{
"mytype": {
"properties": {
"name": {
"type": "string",
"analyzer": "autocomplete"
},
"desc": {
"type": "string",
"analyzer": "autocomplete"
}
}
}
}

Index some example docs

POST /my_index/mytype/_bulk
{"index":{"_id":1}}
{"name":"Brown foxes","desc":"runs fast"}
{"index":{"_id":2}}
{"name":"Yellow furballs","desc":"falls fast"}

Use the "standard" analyzer on the query string

instead of the "autocomplete" analyzer

GET /my_index/mytype/_search
{
"query": {
"multi_match": {
"query": "brown fo",
"analyzer": "standard",
"fields": ["name", "desc"]
}
}
}

GET /my_index/mytype/_search
{
"query": {
"match": {
"name": {
"query": "brown fo",
"analyzer": "standard"
}
}
}
}

Update the mapping for the name field

to use the "autocomplete" analyzer at index time

and the "standard" analyzer at search time

PUT /my_index/mytype/_mapping
{
"mytype": {
"properties": {
"name": {
"type": "string",
"index_analyzer": "autocomplete",
"search_analyzer": "standard",
"include_in_all": true
},
"desc": {
"type": "string",
"index_analyzer": "autocomplete",
"search_analyzer": "standard",
"include_in_all": true
}
}
}
}

Make sure that the mapping is ok

GET /my_index/mytype/_mapping

Search in all fields via multi_match - text in name field found and

result returned
GET /my_index/mytype/_search
{
"query": {
"multi_match": {
"query": "brown fo",
"fields": ["name", "desc"]
}
}
}

Search in all fields via _all field - text in name field found and result

returned
GET /my_index/mytype/_search
{
"query": {
"match": {
"_all": "brown fo"
}
}
}

Search in all fields via multi_match - text in desc field found and

results (both) returned
GET /my_index/mytype/_search
{
"query": {
"multi_match": {
"query": "fa",
"fields": ["name", "desc"]
}
}
}

Search in all fields via _all field - text in desc field is, but no

result returned. multi_match and match in _all field does not return the
same value. How to search in all fields, when I do not know field names?
GET /my_index/mytype/_search
{
"query": {
"match": {
"_all": "fa"
}
}
}

--
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/673cc9ce-1b6f-499f-b59a-cd7919e5cb07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.