0
我正在使用Elasticsearch 1.7並遇到以下問題: 當一個屬性被命名爲索引類型時,我無法過濾屬性而不涉及類型名稱。我更好地展示一個例子:Elasticsearch類型和屬性名稱推理
索引:
curl -XPUT "http://localhost:9200/myindex/ingredient/1" -d'
{
"name": "salad"
}'
curl -XPUT "http://localhost:9200/myindex/product/1" -d'
{
"name": "sandwich",
"ingredient": {
"name": "salad"
}
}'
過濾:
curl -XGET "http://localhost:9200/myindex/_search" -d'
{
"query": {
"term": {
"ingredient.name": "salad"
}
}
}'
響應:
{
"_index": "myindex",
"_type": "ingredient",
"_id": "1",
"_score": 1,
"_source": {
"name": "salad"
}
}
問題: 的響應類型的成分。我想獲得具有屬性ingredient.name =「沙拉」的對象。 Elasticsearch將屬性名稱理解爲一種類型。當我過濾product.ingredient.name =「沙拉」時,我得到了預期的產品。
我不能得到我想過濾的東西的類型,有沒有另一種說法,我的意思是屬性名稱,而不是一種類型?
謝謝,爲了清除。我想,我必須更新。 –