0
私は本当に頑張っていますが、この権利を得るために苦労しています。 実際に私のインデックスマッピングでは、すべてのフィールドがタイプ文字列です。例えば弾性検索DSLクエリPythonの文字列型
{"ind_ecue_fin_ult1":{"mappings":{"ind_ecue_fin_ult1":{"properties":{"age":{"type":"string"},"altaDiff":{"type":"string"},"antiguedad":{"type":"string"},"canal_entrada":{"type":"string"},"cod_prov":{"type":"string"},"conyuemp":{"type":"string"},"empIndex":{"type":"string"},"fecDiff":{"type":"string"},"gender":{"type":"string"},"ind_actividad_cliente":{"type":"string"},"indext":{"type":"string"},"indfall":{"type":"string"},"indrel":{"type":"string"},"indrel_1mes":{"type":"string"},"indresi":{"type":"string"},"nomprov":{"type":"string"},"nuevo":{"type":"string"},"others":{"type":"string"},"renta":{"type":"string"},"residence":{"type":"string"},"segmento":{"type":"string"},"tiprel_1mes":{"type":"string"},"wt":{"type":"double"}}}}}}
私はelasticsearch用のPythonクライアントを使用しては、次のクエリを生成しています
{'query': {'bool': {'minimum_should_match': 5,
'should': [{'boost': 4, 'terms': {'age': '1'}},
{'boost': 3, 'terms': {'antiguedad': '0.0'}},
{'boost': 3.5, 'terms': {'indrel': '1'}},
{'boost': 3, 'terms': {'indrel_1mes': '1'}},
{'boost': 2, 'terms': {'tiprel_1mes': 'A'}},
{'boost': 3, 'terms': {'indresi': 'S'}},
{'boost': 2.5, 'terms': {'indext': 'N'}},
{'boost': 2, 'terms': {'conyuemp': 'DEF'}},
{'boost': 2, 'terms': {'canal_entrada': 'KHL'}},
{'boost': 1.5, 'terms': {'indfall': 'N'}},
{'boost': 1.5, 'terms': {'cod_prov': '28'}},
{'boost': 2, 'terms': {'nomprov': 'MALAGA'}},
{'boost': 1.5, 'terms': {'ind_actividad_cliente': '1'}},
{'boost': 4, 'terms': {'renta': '1'}},
{'boost': 2.5, 'terms': {'segmento': '02 - PARTICULARES'}},
{'range': {'wt': {'boost': 5.0, 'gte': 0.4, 'lte': 0.525}}}]}}}
しかし、私は「shoulds」内の任意の1つの配列用語にしようとした場合でも、この例外を取得しています:
curl -XPOST "htturl -XPOST "http://localhost:9200/ind_ahor_fin_ult1/_search" -d'
{"query": {"bool": {"minimum_should_match": 5,
"should": [{"terms": {"renta": "1"},"boost": 4}]}}}'
{"error":{"root_cause":[{"type":"query_parsing_exception","reason":"[terms] query does not support [renta]","index":"ind_ahor_fin_ult1","line":3,"col":35}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"ind_ahor_fin_ult1","node":"j20MAn_OQ9eRyNsrjf1MRQ","reason":{"type":"query_parsing_exception","reason":"[terms] query does not support [renta]","index":"ind_ahor_fin_ult1","line":3,"col":35}}]},"status":400}
助けてください。 TIA。私は最終的にそれを考え出した
範囲クエリが正常に動作していますが、それらの文字列型クエリが正しくありません –
curl -XPOST "http:// localhost:9200/ind_ahor_fin_ult1/_search" -d ' {"{" bool " "should":{"segmento": "02 - 特定"}}、 "boost":1}}} 'また、配列をステッチすることができるかどうかを確認してください –
curl -XPOST "http :// localhostを:9200/ind_ahor_fin_ult1/_search」「-d { "クエリ":{ "ブール値":{ "あるべき":[ { "マッチ":{ "segmento": "02 - PARTICULARES" }}、 {"renta": "1"}} ] } } } 'これはうまくいった、ちょうど私がブーストパラメータをどこに置くべきか分からない。 –