请大牛指正!通过curl查询:
通过浏览器查询:
[url=http://localhost:9200/cars/_search?pretty]http://localhost:9200/cars/_search?pretty[/url] -d '{"22query":{"match":{"price":20000}}}'
通过代码查询,使用 elasticsearch-dsl:
#coding:utf-8
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q
client = Elasticsearch('192.168.48.128:9200')
s = Search(using=client, index='cars')
s.query("match", make='toyota').query(~Q("match",make='honda'))
response = s.execute()
for hit in s:
print (hit.make,hit.price)
查询结果也是不准确的,7条数据,和浏览器一样。
ES里一共就7条数据。
通过浏览器查询:
[url=http://localhost:9200/cars/_search?pretty]http://localhost:9200/cars/_search?pretty[/url] -d '{"22query":{"match":{"price":20000}}}'
通过代码查询,使用 elasticsearch-dsl:
#coding:utf-8
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q
client = Elasticsearch('192.168.48.128:9200')
s = Search(using=client, index='cars')
s.query("match", make='toyota').query(~Q("match",make='honda'))
response = s.execute()
for hit in s:
print (hit.make,hit.price)
查询结果也是不准确的,7条数据,和浏览器一样。
ES里一共就7条数据。
3 个回复
ciziii
赞同来自:
zxper
赞同来自:
yangruideyang
赞同来自: