Skip to content

Instantly share code, notes, and snippets.

@tenten0213
Created May 22, 2014 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenten0213/40f0bf696d4a006a59f6 to your computer and use it in GitHub Desktop.
Save tenten0213/40f0bf696d4a006a59f6 to your computer and use it in GitHub Desktop.
from elasticsearch import Elasticsearch
es = Elasticsearch()
res = es.search(
index = 'ldgourmet',
doc_type = 'restaurants',
body= {
"query" : {
'simple_query_string': {
"query": "白金台 カフェ ボエム",
"fields": ["name","name_kana", "address"],
"default_operator": "and"
}
}
}
)
print(res)
@tenten0213
Copy link
Author

bodyの下のqueryが足りていなかったのが原因... 😱

from elasticsearch import Elasticsearch

es = Elasticsearch()
res = es.search(
        index = 'ldgourmet',
        doc_type = 'restaurants',
        body= {
            'simple_query_string': {
                "query": "白金台 カフェ ボエム",
                "fields": ["name","name_kana", "address"],
                "default_operator": "and"
            }
        }
    )
print(res)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment