0
私はelasticsearchで新しいです、私はバージョン5.1.2を使用しています。 私はこのインデックスを持っていますが、わかりません。私が_sourceフィールドでうまく作成したかどうか。 loc = XXYとpart = Zのすべてのレジスタを返すクエリが必要です。どうすればいいですか?私はこれで試していますが、うまくいきません。何か案が?弾性検索クエリの検索、_sourceで検索する方法
{
"took": 2,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 107271,
"max_score": 1,
"hits": [
{
"_index": "my_index",
"_type": "po",
"_id": "0",
"_score": 1,
"_source": {
"loc": "XXX",
"part": "YY",
"order_qty": "16",
}
},
{
"_index": "my_index",
"_type": "po",
"_id": "14",
"_score": 1,
"_source": {
"loc": "XXY",
"part": "Z",
"order_qty": "7",
}
},
{
"_index": "my_index",
"_type": "po",
"_id": "19",
"_score": 1,
"_source": {
"loc": "XXY",
"part": "Z",
"order_qty": "8",
}
...
私が使用していたクエリではなく、作品:
GET my_index/po/_search
{
"query" : {
"term" : { "loc" : "XXY", "part": "Z"}
}
}
マッピング:
{
"my_index": {
"mappings": {
"po": {
"properties": {
"loc": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"order_qty": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"part": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
}
}
}
申し訳ありませんが、動作していません... –
それはどういう意味ですか?あなたが間違ったデータや間違ったマッピングを持っている可能性があります、それらを示すplz – Mysterion
間違ったマッピング?私はマップする必要がありますか? –