jprante / elasticsearch-langdetect

A plugin for language detection in Elasticsearch using Nakatani Shuyo's language detector
Apache License 2.0
251 stars 46 forks source link

Not working for nested objects #46

Open cordawyn opened 8 years ago

cordawyn commented 8 years ago

It seems that the language detection does not work for the fields of nested objects. Here's a sample mapping:

{
  mappings: {
    document: {
      properties: {
        title: {
          type: "string",
          copy_to: "l1"
        },
        l1: {
          type: "langdetect",
          store: true
        },
        chunks: {
          type: "nested",
          properties: {
            text: {
              type: "string",
              copy_to: "chunks.l2"
            },
            l2: {
              type: "langdetect",
              store: true
            }
          }
        }
      }
    }
  }
}

and the doc:

{
  title: "hello, world",
  chunks: [
    {
      text: "au revoir"
    }
  ]
}

It works for "l1" field, but it doesn't work for "l2" field. I tried the mapping without "copy_to" (just using those fields directly), to simplify the use case, but to no avail.