Почему запросы возвращают разные данные?

Всем привет. Используется ES версии 1.7.х.
Создаю индекс с вот таким маппингом:

put nestobj
{
"settings" : {
"number_of_shards" : 3,
"number_of_replicas" : 1
},
"mappings":
{
"mytype" :
{
"dynamic_templates": [
{
"nested_feature": {
"path_match" : "_obj",
"mapping" : {
"type" : "nested"
}
}
},
{
"nested_type_template": {
"path_match": "
_obj.Type",
"match_mapping_type" : "string",
"mapping": {
"type" : "string",
"index" : "not_analyzed"
}
}
},
{
"nested_value_template" : {
"path_match" : "*_obj.Value",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string",
"index" : "analyzed"
}
}
}
],
"properties" : {
"_id" : {
"type" : "string",
"index" : "not_analyzed"
},
"product" : {
"type" : "string",
"index" : "analyzed"
},
"manufacturer" : {
"type" : "string",
"index" : "analyzed"
}
}
}
}
}

Основной особенностью является требование к динамическим полям: они должны создаваться с 2 "свойствами" - Value(анализ.) и Type(не анализ.). Далее добавляю данные:

post nestobj/mytype/_bulk
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde3"}}
{"product" : "myproduct_1", "manufacturer" : "company_1"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde4"}}
{"product" : "myproduct_2", "manufacturer" : "company_2"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde5"}}
{"product" : "myproduct_3", "manufacturer" : "company_1", "properties_obj.Value" : "value_for_product_3", "properties_obj.Type" : "newtype"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde6"}}
{"product" : "myproduct_4", "manufacturer" : "company_2", "properties_obj.Value" : "value_for_product_4", "properties_obj.Type" : "type"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde7"}}
{"product" : "myproduct_5", "manufacturer" : "company_1", "properties_obj.Value" : "value_for_product_3", "properties_obj.Type" : "newtype", "settings_obj.Value" : "settings_for_product_5", "settings_obj.Type" : "settings type"}

Если к этим данным делать запросы на поиск вида :

get nestobj/mytype/_search
{
"query": {
"term": {
"settings_obj.Type": {
"value": "settings type"
}
}
}
}

get nestobj/mytype/_search?q=settings_obj.Type:settings type

, то возвращаются разные наборы данных. На первый запрос вернутся все документы, даже не содержащие искомое значение. Второй запрос возвращает более корректный результат, но почему-то вместо одного документа вернулось 2. Учитывая, что поиск ведется по полю с типом индекса "not_analyzed", не понятно - почему срабатывает документ без этого поля?

Как так получается?? Возможно я неправильно делаю Mapping? Тогда как он должен выглядеть под мои условия (динамические поля с 2 "свойствами")??

Тут 3 проблемы:

  1. Неправильно отформатирован запрос bulk. В версии 1.x {"foo.bar": "baz"} и {"foo": {"bar": "baz"}} - это два разных документа. Чтобы сделать nested, надо пользоваться вторым вариантом:
POST nestobj/mytype/_bulk
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde3"}}
{"product" : "myproduct_1", "manufacturer" : "company_1"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde4"}}
{"product" : "myproduct_2", "manufacturer" : "company_2"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde5"}}
{"product" : "myproduct_3", "manufacturer" : "company_1", "properties_obj": {"Value" : "value_for_product_3", "Type" : "newtype"}}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde6"}}
{"product" : "myproduct_4", "manufacturer" : "company_2", "properties_obj": {"Value" : "value_for_product_4", "Type" : "type"}
{"index":{"_id":"768198f9-f61f-4fb0-a16e-3b56f1c4dde7"}}
{"product" : "myproduct_5", "manufacturer" : "company_1", "properties_obj": {"Value" : "value_for_product_3", "Type" : "newtype"}, "settings_obj": {"Value" : "settings_for_product_5", "Type" : "settings type"}}

  1. Что бы искать объекты с типом nested, надо пользоваться специальным запросом с типом nested:
GET nestobj/mytype/_search
{
  "query": {
    "nested": {
      "path": "settings_obj",
      "query": {
        "term": {
          "settings_obj.Type": {
            "value": "settings type"
          }
        }
      }
    }
  }
}
  1. Судя по документам и запросам в примере nested вам ни к чему. Возможно, просто плохой пример.

Игорь, спасибо за ответы!
По 3 пункту попробую выборку как с object, так и с nested.
Еще раз спасибо за помощь!