I need multilanguage text search for documents and decided to use types and 
multi_match queries for that as described in 
http://www.elastic.co/guide/en/elasticsearch/guide/current/mapping.html 

It works smoothly for flat documents, but I cannot figure out whether it is 
applicable to nested documents too.
Here is a test index "persons"
 

{
    "settings" : {
        "number_of_shards" : 2
    },
    "mappings" : {
        "person_eng":{
            "properties": {
                "name" : {
                    "type" : "string", "analyzer" : "english"
                },
                "car":{
                    "properties": {
                        "make": {
                            "type": "string", "analyzer" : "english"
                        },
                        "model": {
                            "type": "string", "analyzer" : "english"
                        }
                    },
                    "type" : "nested"
                }
            }
        },
       "person_de":{
            "properties": {
                "name" : {
                    "type" : "string", "analyzer" : "german"
                },
                "car":{
                    "properties": {
                        "make": {
                            "type": "string", "analyzer" : "german"
                        },
                        "model": {
                            "type": "string", "analyzer" : "german"
                        }
                    },
                    "type" : "nested"
                }
            }
        }

    }
}


After putting documents

curl -XPUT 'http://localhost:9200/persons/person_eng/1' -d '{
  "name" : "Bob Mahoney",
  "car" :
    {
      "make" : "Vickers Armstrongs",
      "model" : "Matilda"
    }
}'

curl -XPUT 'http://localhost:9200/persons/person_de/1' -d '{
  "name" : "Heinz Guderian",
  "car" : 
    {
      "make" : "Porsche",
      "model" : "Tiger"
    }
}'


the following query works as expected

{
  "query": {
    "multi_match": {
      "query": "Heinz",
      "fields": [
        "person_de.name",
        "person_eng.name"
      ]
    }
  }
}

but a nested query doesn't return any result

{
  "query": {
    "nested": {
      "path": "car",
      "query": {
        "multi_match": {
          "query": "Heinz",
          "fields": [
            "person_de.car.make",
            "person_eng.car.make"
          ]
        }
      }
    }
  }
}


What is wrong here?

If fully qualified field name (including type name) is not supported in 
multi_match query for nested documents, I quess it can be replaced by 
corresponding 
dis_max or boolean query.

Thanks in advance!

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/58601881-763c-4194-9f04-0a0735a3f822%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to