私はPythonでElastic検索を使用しています。私はアクセントで鈍感な検索をする方法を見つけることができません。弾性検索非表示検索アクセント
例: 2つの単語があります。 "カミオン"及び "カムニオン"。 ユーザーが「camion」を検索すると、2つの結果が表示されます。
作成インデックス:
es = Elasticsearch([{u'host': u'127.0.0.1', u'port': b'9200'}])
es.indices.create(index='name', ignore=400)
es.index(
index="name",
doc_type="producto",
id=p.pk,
body={
'title': p.titulo,
'slug': p.slug,
'summary': p.summary,
'description': p.description,
'image': foto,
'price': p.price,
'wholesale_price': p.wholesale_price,
'reference': p.reference,
'ean13': p.ean13,
'rating': p.rating,
'quantity': p.quantity,
'discount': p.discount,
'sales': p.sales,
'active': p.active,
'encilleria': p.encilleria,
'brand': marca,
'brand_title': marca_titulo,
'sellos': sellos_str,
'certificados': certificados_str,
'attr_naturales': attr_naturales_str,
'soluciones': soluciones_str,
'categories': categories_str,
'delivery': p.delivery,
'stock': p.stock,
'consejos': p.consejos,
'ingredientes': p.ingredientes,
'es_pack': p.es_pack,
'temp': p.temp,
'relevancia': p.relevancia,
'descontinuado': p.descontinuado,
}
検索:私はグーグル、stackoverflowのとelastic.coで検索しましたが、私は働く何かを見つけることができませんでした
from elasticsearch import Elasticsearch
es = Elasticsearch([{'host': '127.0.0.1', 'port': '9200'}])
resul = es.search(
index="name",
body={
"query": {
"query_string": {
"query": "(title:" + search + " OR description:" + search + " OR summary:" + search + ") AND (active:true)",
"analyze_wildcard": False
}
},
"size": "9999",
}
)
print resul
。
を、あなたのクエリで使用これらのフィールドのマッピングは何ですか? –
あなたはデータベースを意味しますか?すべての文字列。クエリで何か宣言する必要はありますか? –
どのデータベースですか? :-) –