I want to create this example
GET /my_store/products/_search
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"price" : 20
}
}
}
}
}
using Pythons elasticsearch_dsl.
import elasticsearch as ES
import elasticsearch_dsl as dsl
from elasticsearch_dsl import Search
client = ES.Elasticsearch()
s = Search(using = client, index = "my_store")
ok, this indicates the host, port, and index.
s = s.filter("term", price = 20)
results = s.execute().to_dict()
but how to specify the type of document - is it "products"? Looks like there should be an argument in the Search () function.
A similar question, suppose I want to run the same query, but I want it to work on the indices "my_store" and "her_store". How to indicate this?
source
share