pyelasticsearch
python elasticsearch client
I have documents in elasticsearch that are something like:
{
"numberOfBedrooms": 2,
"price": 1500,
"type": flat
}
I would like to get statistics like what is the average price by room, what is the average price by type and also combinations like what is the average price per numberOfBedroom+type combinations. How can I use aggregations in elastic search to achieve that?
Thanks!
Source: (StackOverflow)
I have an index created using the following pyelasticsearch code:
EDIT: UPDATED AGAIN 11/12/13 18:31 GMT
entry_mapping = {
'product': {
'properties': {
'_advertiser_id': {'type': 'integer'},
'advertiser': {'type': 'string'},
'category': {'type': 'string'},
'created_at': {'type': 'date'},
'description': {'type': 'string'},
'fields': {
'type': 'nested',
'properties': {
'gender': {'type': 'string'},
'short_type': {'type': 'string'}
}
},
'id': {'type': 'string'},
'name': {'type': 'string'},
'price': {'type': 'float'},
'product_type': {'type': 'string'},
'updated_at': {'type': 'date'},
'variations': {'type': 'nested'},
}
}
}
es.create_index('product', settings={'mappings': entry_mapping})
Query mapping returned using curl -XGET localhost:9200/products/_mapping
after data has been imported:
{
"product" : {
"product" : {
"properties" : {
"_advertiser_id" : {
"type" : "integer"
},
"advertiser" : {
"type" : "string"
},
"category" : {
"type" : "string"
},
"created_at" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"description" : {
"type" : "string"
},
"fields" : {
"type" : "nested",
"properties" : {
"gender" : {
"type" : "string"
},
"short_type" : {
"type" : "string"
}
}
},
"id" : {
"type" : "string"
},
"images" : {
"properties" : {
"id" : {
"type" : "string"
},
"url" : {
"type" : "string"
}
}
},
"name" : {
"type" : "string"
},
"price" : {
"type" : "float"
},
"product_type" : {
"type" : "string"
},
"updated_at" : {
"type" : "date",
"format" : "dateOptionalTime"
},
"variations" : {
"type" : "nested",
"properties" : {
"colour" : {
"type" : "string"
},
"female_tops" : {
"type" : "string"
},
"image" : {
"type" : "string"
},
"length" : {
"type" : "string"
},
"size" : {
"type" : "string"
},
"sleeve_length" : {
"type" : "string"
},
"type" : {
"type" : "string"
},
"zip_type" : {
"type" : "string"
}
}
}
}
}
}
}
I am successfully querying using the following query:
curl -XGET 'http://127.0.0.1:9200/products/_search?size=100' -d '{"query": {"filtered": {"query": {"query_string": {"query": "t-shirt"}}}}}'
The following is an example result:
{
"_index":"product",
"_type":"product",
"_id":"525adf3fd1f4677e32d0f996",
"_score":0.034907393,
"_source":{
"category":"T-Shirts",
"advertiser":"string",
"product_type":"Clothing",
"description":"string",
"fields":{
"gender":"M"
},
"created_at":"2013-10-07T13:24:03.182000",
"variations":[
{
"colour":"Grey",
"sleeve_length":"Short sleeved",
"size":"S"
},
{
"colour":"Grey",
"sleeve_length":"Short sleeved",
"size":"M"
},
{
"colour":"Grey",
"sleeve_length":"Short sleeved",
"size":"L"
}
],
"updated_at":"2013-10-19T13:54:29.796000",
"price":12.0,
"images":[
{
"url":"https://s3-eu-west-1.amazonaws.com/...",
"id":"525adf23d1f4677e32d0f994",
"resource_uri":""
},
{
"url":"https://s3-eu-west-1.amazonaws.com/...",
"id":"525adf30d1f4677e32d0f995",
"resource_uri":""
}
],
"_advertiser_id":4,
"id":"525adf3fd1f4677e32d0f996",
"name":"Fresh Charcoal"
}
}
I am trying to execute the following query using pyelsticsearch.
self.query = {
'query': {
'filtered': {
'query': {
'query_string': {'query': self.query_str}
},
'filter': {
'and': [
{
'range': {
'price': {
'gte': self.min_price,
'lte': self.max_price
}
},
},
{
'terms': {
'_advertiser_id': self.advertisers,
},
},
{
'term': {
'fields.gender': self.gender.lower(),
},
},
{
'nested': {
'path': 'variations',
'query': {'match_all': {}},
'filter': {
'and': [
{
'terms': {
'variations.size': [s.lower() for s in self.sizes]
},
},
{
'term': {
'variations.colour': self.colour.lower(),
}
}
]
}
}
},
]
},
}
}
}
Unfortunately it fails to return any results when there is data matching the query. Any help would be greatly appreciated.
UPDATE: 12/12/13 11:40 GMT
Below is an example of the JSON produced by the query code above.
curl -XGET 'http://127.0.0.1:9200/product/_search?size=100' -d '
{
"query":{
"filtered":{
"filter":{
"and":[
{
"range":{}
},
{
"terms":{
"_advertiser_id":[
7,
4
]
}
},
{
"term":{
"fields.gender":"m"
}
},
{
"nested":{
"filter":{
"and":[
{
"terms":{
"variations.size":[
"xs",
"s",
"m",
"l",
"xl",
"xxl"
]
}
},
{
"term":{
"variations.colour":"black"
}
}
]
},
"path":"variations",
"query":{
"match_all":{
}
}
}
}
]
},
"query":{
"query_string":{
"query":"t-shirt"
}
}
}
}
}'
UDPATED: 12/12/13 11:51 GMT
Things get stranger. Having stripped down the query the following gives results.
curl -XGET 'http://127.0.0.1:9200/product/_search?size=100' -d '{
"query":{
"filtered":{
"filter":{
"and":[
{
"nested":{
"filter":{
"an":[
{
"terms":{
"variations.size":[
"xs",
"s",
"m",
"l",
"xl",
"xxl"
]
}
},
{
"term":{
"variations.colour":"black"
}
}
]
},
"path":"variations",
"query":{
"match_all":{
}
}
}
}
]
},
"query":{
"query_string":{
"query":"t-shirt"
}
}
}
}
}'
Example result data from above query:
{
"_index":"product",
"_type":"product",
"_id":"525ade5ad1f4677e32d0f993",
"_score":0.10493462,
"_source":{
"category":"T-Shirts",
"advertiser":"...",
"product_type":"Clothing",
"description":"...",
"fields":{
"gender":"M"
},
"created_at":"2013-10-07T13:24:03.182000",
"variations":[
{
"colour":"Black",
"sleeve_length":"Short sleeved",
"size":"S"
},
{
"colour":"Black",
"sleeve_length":"Short sleeved",
"size":"M"
},
{
"colour":"Black",
"sleeve_length":"Short sleeved",
"size":"L"
}
],
"updated_at":"2013-10-19T14:05:34.299000",
"price":0.0,
"images":[
{
"url":"...",
"id":"525ade50d1f4677e30a2cb3a",
"resource_uri":""
}
],
"_advertiser_id":4,
"id":"525ade5ad1f4677e32d0f993",
"name":"..."
}
}
*UPDATED: 21/12/2012 10:48 GMT *
I have isolated the part of the query that's being problematic—i.e. not returning any results—when combined with the entirety of the query.
{
'term': {
'fields.gender': self.gender.lower(),
},
}
Exemplar working query:
curl -XGET 'http://127.0.0.1:9200/product/_search?size=100' -d '{
"query":{
"filtered":{
"filter":{
"and":[
{
"range":{
"price":{
"gte":0.0,
"lte":200.0
}
}
},
{
"terms":{
"_advertiser_id":[
7,
4
]
}
},
{
"nested":{
"filter":{
"and":[
{
"terms":{
"variations.size":[
"xs",
"s",
"m",
"l",
"xl",
"xxl"
]
}
},
{
"term":{
"variations.colour":"black"
}
}
]
},
"path":"variations",
"query":{
"match_all":{
}
}
}
}
]
},
"query":{
"query_string":{
"query":"t-shirt"
}
}
}
}
}'
Exemplar unworking query:
curl -XGET 'http://127.0.0.1:9200/product/_search?size=100' -d '{
"query":{
"filtered":{
"filter":{
"and":[
{
"range":{
"price":{
"gte":0.0,
"lte":200.0
}
}
},
{
"terms":{
"_advertiser_id":[
7,
4
]
}
},
{
"term":{
"fields.gender":"m"
}
},
{
"nested":{
"filter":{
"and":[
{
"terms":{
"variations.size":[
"xs",
"s",
"m",
"l",
"xl",
"xxl"
]
}
},
{
"term":{
"variations.colour":"black"
}
}
]
},
"path":"variations",
"query":{
"match_all":{
}
}
}
}
]
},
"query":{
"query_string":{
"query":"t-shirt"
}
}
}
}
}'
Source: (StackOverflow)
Is there any way to import a JSON file (contains 100 documents) in elasticsearch server? I want to import a big json file into es-server..
Source: (StackOverflow)
I want to have a complex ranking made out of several functions that I want to weight and multiply with the search _score. I understand this is possible with the function_score -> functions parameter. Here's what I have (note, this is Python):
"function_score": {
"query": ...,
"functions": [
{
"random_score" : {
"seed": seed
},
"weight": 0.1
},
{
"field_value_factor": {
"field": "score"
},
"weight": 1
}
],
"score_mode": "multiply"
}
Notes:
- Each document has a "score" field which contains a number between 0 and 1
- "seed" is generated based on user-id and current date
Observed behavior:
- If I comment out the field_value_factor function, the results are ranked randomly.
- If I comment out the random_score function, the results are ordered by their score field.
- If I don't comment out anything, the result is the same as with only random: The second function seems to be ignored
- Even changing the weights to drastic values do not make any difference in the ranking
- Also, using a "factor" inside the field_value_factor function does not do anything
- Swapping the order does not change behavior either...
What am I doing wrong? Any other ways to debug this?
EDIT: Explain output
Just found out about the explain command! Here is the output for the result with the highest score. Trying to wrap my head around it...
"_explanation": {
"value": 0,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "ConstantScore(*:*), product of:",
"details": [
{
"value": 1,
"description": "boost"
},
{
"value": 1,
"description": "queryNorm"
}
]
},
{
"value": 0,
"description": "Math.min of",
"details": [
{
"value": 0,
"description": "function score, score mode [multiply]",
"details": [
{
"value": 90500,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*"
},
{
"value": 90500,
"description": "product of:",
"details": [
{
"value": 9.05,
"description": "field value function: (doc['score'].value * factor=10.0)"
},
{
"value": 10000,
"description": "weight"
}
]
}
]
},
{
"value": 0,
"description": "function score, product of:",
"details": [
{
"value": 1,
"description": "match filter: *:*"
},
{
"value": 0,
"description": "product of:",
"details": [
{
"value": 0,
"description": "random score function (seed: 16121)"
},
{
"value": 0.01,
"description": "weight"
}
]
}
]
}
]
},
{
"value": 3.4028235e+38,
"description": "maxBoost"
}
]
},
{
"value": 1,
"description": "queryBoost"
}
]
}
EDIT 2:
So it seems the random function always returns 0, and that multiplied with the other factors of course totals 0... Why is that?
Source: (StackOverflow)
I have a model whose flow is as follows
CMS --> Postgres --> Elasticsearch --> Querying from Elasticsearch --> Final Result
Everyday, new fields are added in CMS and the data is subsequently pushed into Elasticsearch. However, this takes up a lot of time, given the huge amount of data.
Could there be a way so that, every time a new entry is added to CMS, it simultaneously gets pushed to Elasticsearch, without manually prompting the application to do so?
I want to automate the process of pushing data into Elasticsearch from CMS. Any input would be welcome.
Also, I'm using elasticsearch-py as framework.
Source: (StackOverflow)
I am trying to connect and retrieve data from a ES engine.
I am using the following script:
from elasticsearch import Elasticsearch as ES
print "Setup connection..."
es=ES(['http://elasticsearch......com:9200/cuevents-2014.34,cuevents-2014.33/_search?pretty'])
print "Done!"
print "Count number of users..."
print es.count(index='cuevents-2014.34')
But I am getting the following messaged returned instead.
Setup connection...
No handlers could be found for logger "elasticsearch"
Done!
Count number of users...
Traceback (most recent call last):
File "/home/es.py", line 8, in <module>
print es.count(index='cuevents-2014.34')
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/utils.py", line 68, in _wrapped
return func(*args, params=params, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/client/__init__.py", line 622, in count
params=params, body=body)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/transport.py", line 284, in perform_request
status, headers, data = connection.perform_request(method, url, params, body, ignore=ignore, timeout=timeout)
File "/usr/local/lib/python2.7/dist-packages/elasticsearch/connection/http_urllib3.py", line 51, in perform_request
raise ConnectionError('N/A', str(e), e)
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.', gaierror(-2, 'Name or service not known'))) caused by: ProtocolError(('Connection aborted.', gaierror(-2, 'Name or service not known')))
I am trying to connect and return the number of documents in the index cuevents-2014.34
Source: (StackOverflow)
My sample document looks like this.
{
"user": "dslfjd",
"productLength": 68,
"productPrice": 4500,
"action": "Made Purchse"
}
I want to get all the users that brought products whose price is between 4000 and 10000 and whose length is between 50 and 100. The following query returns all the documents that satisfy the above conditions.
{
"query": {
"bool": {
"must": [
{
"term": {
"act": "Made Purchase"
}
},
{
"range": {
"productPrice": {
"gte": 4000,
"lte": 10000
}
}
},
{
"range": {
"length": {
"gte": 50,
"lte": 100
}
}
}
]
}
}
}
Here I will get all the documents that satisfy the above query clauses, I can even project my response by just specifying "_source" = ["user"]
so that I don't get the entire document but just the user
Instead what I want is a list of all the unique distinct users. Instead of all the documents that may have user
field repeated.
An aggregation like below
{
"aggs": {
"unique_users": {
"terms": {
"field": "user"
}
}
}
}
aggregates all the documents, instead I want aggregation on documents that satisfy any query. I feel like I'm missing a simple thing like defining my query inside my aggregation. But I don't know what it is.
Source: (StackOverflow)
I'm using Haystack to connect and interact with an installation of elasticsearch. Elasticsearch is installed on a different box to the main webserver.
I have set up HTTP authentication on the elasticsearch box using nginx. This is to stop unauthorised access to elasticsearch.
The Haystack config looks like this:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://USERNAME:PASSWORD@DOMAIN:PORT/',
'INDEX_NAME': 'haystack',
},
}
With this set up I get a connection error:
elasticsearch.exceptions.ConnectionError: ConnectionError(('Connection aborted.',
gaierror(-2, 'Name or service not known'))) caused by: ProtocolError(('Connection
aborted.', gaierror(-2, 'Name or service not known')))
If I turn off HTTP authentication and update the URL correspondingly to http://DOMAIN:PORT/
it connects without a problem.
Could it be that Haystack (or elasticsearch-py (http://www.elasticsearch.org/guide/en/elasticsearch/client/python-api/current/) doesn't allow HTTP authentication to be used in the URL? I notice this is a problem with Solr - Solr authentication (using Django Haystack)
Source: (StackOverflow)
I use elastic search for news articles search. If I search for "Vlamadir Putin", it works because he is in news a lot and Vlamidir and Putin are both not very popular. But if I search for "Raja Ram", it does not work. I have a few articles of "Raja Ram", but some of "Raja Mohanty" and "Ram Srivastava". These articles rank higher than articles quoting "Raja Ram". Is there something wrong in my tokenizer or search functions?
es.indices.create(
index="article-index",
body={
'settings': {
'analysis': {
'analyzer': {
'my_ngram_analyzer' : {
'tokenizer' : 'my_ngram_tokenizer'
}
},
'tokenizer' : {
'my_ngram_tokenizer' : {
'type' : 'nGram',
'min_gram' : '1',
'max_gram' : '50'
}
}
}
}
},
# ignore already existing index
ignore=400
)
res = es.search(index="article-index", fields="url", body={"query": {"query_string": {"query": keywordstr, "fields": ["text", "title", "tags", "domain"]}}})
Source: (StackOverflow)
I have documents of type:
[{"msg":"hello", date: "some-date"},{"msg":"hi!", date: "some-date"}, ...
I want to have the count of documents by day of week. For example x messages were sent on Monday and y were sent on Tuesday and so on.
I have used date_histogram with aggregation but it returns me the documents day wise. It does return me the day, but say "Wed, 22" and "Wed, 29" are returned as separate aggregation documents.
This is somewhat related to Elasticsearch - group by day of week and hour but there is no answer to that question so I am reposting it.
According to the suggestion there it asks me to do term aggregation on key_as_string, but I need to add doc_count for every object instead of just count the terms. I also don't know how to use key_as_string in the nested aggregation.
This is what I have tried:
"aggs" : {
"posts_over_days" : {
"date_histogram" : {
"field" : "created_time",
"interval": "day",
"format": "E"
}
}
Source: (StackOverflow)
I'm wondering what the best combination of Django-Haystack + elasticsearch + pyelasticsearch/elasticsearch-py is. I've deployed a setup using Haystack 2.1.1-dev + elasticsearch 1.1.1 + elasticsearch-py 1.0 on an Ubuntu 12.04 machine. I tried using Haystack 2.1.0 (latest stable release) with elasticsearch 1.1.1 and pyelasticsearch 0.6.1, but it kept throwing me an error saying Django-Haystack depends on pyelasticsearch; so I switched to 2.1.1-dev, which worked beautifully.
But now I'm trying deploy an instance of a Django app to a CentOS 6.5 machine (Haystack 2.1.1-dev + elasticsearch 1.1.1 + elasticsearch-py 1.0), and I'm getting the same pyelasticsearch dependency error.
Any hints or tips from someone who has deployed to CentOS would be much appreciated.
Source: (StackOverflow)
Using ElasticSearch I'm trying to use the minimum_should_match
option on a Terms Query
to find documents that have a list of long
s that is X%
similar to the list of long
s I'm querying with.
e.g:
{
"filter": {
"fquery": {
"query": {
"terms": {
"mynum": [1, 2, 3, 4, 5, 6, 7, 8, 9, 13],
"minimum_should_match": "90%",
"disable_coord": False
}
}
}
}
}
will match two documents with a mynum
list of:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
and:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12]
This works and is correct since the first document has a 10
at the end while the query contained a 13
and the second document contained an 11
where again the query contained a 13
.
Which means that 1 ou of 10 numbers in my query's list is different in the returned document and amounts to the allowed 90%
similarity (minimum_should_match
) value in the query.
Now the issue that I have is that I would like the behaviour to be different in the sense that since the second document is longer and has 11 numbers in place of 10, the difference level should ideally have been higher since it has actually two values 11
and 12
that are not in the query's list. e.g:
Instead of computing the intersection of:
(list1) [1, 2, 3, 4, 5, 6, 7, 8, 9, 13]
with:
(list2) [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12]
which is a 10%
difference
it should say that since list2
is longer than list1
, the intersection should be:
(list2) [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12]
with:
(list1) [1, 2, 3, 4, 5, 6, 7, 8, 9, 13]
which is a 12%
difference
- Is this possible ?
- If not, how could I weight in the length of the list besides using a dense vector rather than a sparse one ? e.g:
using
[1, 2, 3, 4, 5, 6, 7, 8, 9, , , , 13]
rather than:
[1, 2, 3, 4, 5, 6, 7, 8, 9, 13]
Source: (StackOverflow)
I have indexed data from MySQL to elastic search using pyelasticsearch client. But when when i try to get the indexed data i am getting only few records i have 166
records but i am getting only this :
{"took":23,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":166,"max_score":1.0,"hits":[{"_index":"scraped_data","_type":"products","_id":"08e6fp_7T6OJ5LcNaf9juQ","_score":1.0, "_source" : {"productTitle": "Elegant Jacquard Stockings In Black", "productPrice": 0.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.moodsofcloe.com/product/elegant-jacquard-stockings-in-black", "productDesc": "Turn up the heat tonight Sensual jacquard panty hose is made from high tech fiber providing super restoring force and dense texture Its lovely soft sheen is enhanced with a trail of floral motif ", "availability": 1, "productMRP": 449.0, "productSite": "http://www.moodsofcloe.com/", "productCategory": "women", "image_paths": "[\"full/aac34369c3bb33fe31589452b3f1e9b4f5371c13.jpg\", \"full/fe4be81ee2c4fff7ea1d475824ba458a43c177d0.jpg\", \"full/460f0f7b448720d1c0c6389e0fb50bb7a80e4d82.jpg\", \"full/b8a219f8e3295d30cc244ff0a08f3fdade6e4eb8.jpg\", \"full/a5c5cb84a4c1f07931cf9a116c3abfb11d4da18a.jpg\", \"full/b1e8902c029a1eb2225f0fac02ceef6f27fa3c22.jpg\", \"full/6b6916dda672112660259f00383669b4916aea25.jpg\", \"full/3f7a6aa16c79ef6d5df8d19bbe7480742925256c.jpg\"]", "productSubCategory": "stockings"}},{"_index":"scraped_data","_type":"products","_id":"s3Q6tNP1SXGvlz7WCFsecg","_score":1.0, "_source" : {"productTitle": "Elegant Floral Stockings In Black", "productPrice": 0.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.moodsofcloe.com/product/elegant-floral-stockings-in-black", "productDesc": "Elegant Floral Stockings In Black Sensual jacquard panty hose is made from high tech fiber providing super restoring force and dense texture Its lovely soft sheen enhanced with a trail of floral motif ", "availability": 1, "productMRP": 449.0, "productSite": "http://www.moodsofcloe.com/", "productCategory": "women", "image_paths": "[\"full/85cc2fdbf2781b0187d469d69e0a1bfb10c64aea.jpg\", \"full/3476998ca1f5954b07b0f1bc769c04429bb8fadc.jpg\", \"full/5338053f24a56976082c7e8782665dbe0ed106d0.jpg\", \"full/3c06336f6bd2fd2aabbd0067a4dbfd72e9dcf6fe.jpg\", \"full/c0185369b18d9a0ef26948266edd980a973fd856.jpg\", \"full/33774893e7e8a10b0e59fcd7707d7eacab2168df.jpg\", \"full/90c59ab0fb13bed1552b91145a2e5f5d2d47de8f.jpg\", \"full/2127e8b15b4a53244879d9ef5ba1cd101a978f2a.jpg\"]", "productSubCategory": "stockings"}},{"_index":"scraped_data","_type":"products","_id":"vYpJMQ0GTza2PDh2U6MnEA","_score":1.0, "_source" : {"productTitle": "ENAMEL FLOWER FASHION NECKLACE, NJW123", "productPrice": 0.0, "hasVariants": 0, "currency": "INR", "productURL": "http://www.n-gal.com/jewelry/enamel-flower-fashion-necklace-njw123", "productDesc": "ENAMEL FLOWER FASHION NECKLACE", "availability": 1, "productMRP": 575.0, "productSite": "http://www.n-gal.com/", "productCategory": "women", "image_paths": "[\"full/4b97d2a1ec06a29c3d0ef7b803ff181de07f8a73.jpg\"]", "productSubCategory": "jewellery"}},{"_index":"scraped_data","_type":"products","_id":"UtOxLskuTEqIa5cNhnk63Q","_score":1.0, "_source" : {"productTitle": "Bra, Panty and Lingerie Organiser Travel Bag, NBB11", "productPrice": 0.0, "hasVariants": 0, "currency": "INR", "productURL": "http://www.n-gal.com/lingerie-bags/bra-panty-and-lingerie-organiser-travel-bag-nbb11", "productDesc": "1 You get a Bra and Panty Lingerie Carry Bag 2 It saves space inside your travelling bag and keeps all your lingerie well organised and safe 3 Saves your from embarrasment of all your lingerie lying here and there while someone else might open your wardrobe Briefcase travel bag etc 4 Comes in beautiful feminine colors and shades 5 High Quality Zipper and material to keep the bag in proper shape MATERIAL SATIN EVA LACE M R P Rs 999 00", "availability": 1, "productMRP": 699.0, "productSite": "http://www.n-gal.com/", "productCategory": "women", "image_paths": "[\"full/af68e31d96eb12fb8ebdcd45844247fa5b27e81a.jpg\", \"full/55ed7783ac85255150f7ba4d501b2917b9adf136.jpg\", \"full/98db4ed6a7b557cb88e3991c99eaadd5797796bd.jpg\", \"full/5c8820607520f4171aa149ec4381669f2410ad2d.jpg\", \"full/e5d57a12a6eaaa01e690d3c11428f55da5a155f0.jpg\", \"full/e87cfb4a6b1586341c5d2fd54bfa0d7273e24683.jpg\", \"full/e976c56e9170e97f451bba6e6aa3f788931edc1a.jpg\"]", "productSubCategory": "lingerie-bags"}},{"_index":"scraped_data","_type":"products","_id":"rU5OwV8jQ-GGr9co8oxj7Q","_score":1.0, "_source" : {"productTitle": "Coins' Bracelet", "productPrice": 0.0, "hasVariants": 0, "currency": "INR", "productURL": "http://www.shopnineteen.com/jewelry/metal-coins-bracelet.html", "productDesc": "Add a bohemian appeal to your ensemble with this braided bracelet with metal coins Stack it with other metal bangles and increase your style quotient tenfold ", "availability": 1, "productMRP": 399.0, "productSite": "http://www.shopnineteen.com", "productCategory": "women", "image_paths": "[\"full/c293ecd489bddba86faa039a3010adae4329c776.jpg\", \"full/66069c79141609e3c9b6d2febfec4d7965fdd9d3.jpg\"]", "productSubCategory": "jewellery"}},{"_index":"scraped_data","_type":"products","_id":"gIBdMlncTJqnFd_tAJnNpw","_score":1.0, "_source" : {"productTitle": "Mishka Scarlett Frost Tunic", "productPrice": 0.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.styleever.com/index.php/western/tops-tunics/mishka-scarlett-frost-tunic-2463.html", "productDesc": "A true touch of color and style This easy to wear design is met by an all around comfortable fit The Cherry Red material drapes perfectly for a flattering appearance A lovely scoop neck is met by feminine crochet detail that creates a wonderful textured contrast Soft short sleeves complete the look ", "availability": 1, "productMRP": 899.0, "productSite": "http://www.styleever.com", "productCategory": "women", "image_paths": "[\"full/f6aae3e2a27b4d45b15c6d5861abcf1481a039c6.jpg\", \"full/0761e28e43ffb05aae380900acce37a526b3a97b.jpg\", \"full/4df6dc22b2a1580346b7654f3f8cf141316dd3b4.jpg\", \"full/5b1dead1b992b0e4fd15f6c36edc2adfc4b3c6c3.jpg\"]", "productSubCategory": "tops"}},{"_index":"scraped_data","_type":"products","_id":"163mkGSbQkmCQzQE43hYbQ","_score":1.0, "_source" : {"productTitle": "Mishka Sprouting Floral Kurti", "productPrice": 0.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.styleever.com/index.php/ethnic/kurtis/mishka-sprouting-floral-kurti.html", "productDesc": "The eyecatching and whimsical floral motif is always preferable to enhance your personality Pamper the women in you in this beautifull Kurti The unique blend of the colors and the print is making it perfect to grab the attention ", "availability": 1, "productMRP": 299.0, "productSite": "http://www.styleever.com", "productCategory": "women", "image_paths": "[\"full/c12be96682b49cc74a3dcc5ff153a9e5b1321e6d.jpg\", \"full/db9bc75e616bb050c1a2231e1ba65d27b16a6d31.jpg\", \"full/d29251db981c55bae72131822dbd4c9b8610a65d.jpg\", \"full/8cbfbcc356888c6dc4fb680cd0197d73a7cccafa.jpg\", \"full/a61fee8b5e782b65a759c464dc3421abc9791f3f.jpg\", \"full/c300d08af7231e31f17a9693b5acca129713c0a5.jpg\", \"full/2d1c6cab21dd8fb759ff66fe98e3cfb593599637.jpg\", \"full/e56ed457dd1d126a831592bbed78d23fc7c92dcd.jpg\", \"full/aef7b8b0861c837dea09c14b3ecc166a9c67f80f.jpg\", \"full/af335ecaec6403118505665e981632d9ba27b31d.jpg\", \"full/10f6fd7229e079e39a19cc7024e415592d0a9321.jpg\", \"full/1b7769847936bcb0ff2356afc5645c6787f1f8f3.jpg\", \"full/88211ab1f8bb4bce867535ef3527fadc4161b669.jpg\", \"full/abafd12788cd0e7c4b4a90131d9878c8b59617f7.jpg\", \"full/2a591ad13b3b2ef2c5b076e392a813b5e14edd16.jpg\", \"full/123f8ba7292dab2ef7055487abc5352e73edacad.jpg\"]", "productSubCategory": "kurti"}},{"_index":"scraped_data","_type":"products","_id":"BrTW_SBMR0KGNmkH2FLlpg","_score":1.0, "_source" : {"productTitle": "Mishka Turquoise Top", "productPrice": 599.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.styleever.com/index.php/western/tops-tunics/mishka-turquoise-top.html", "productDesc": "This cambric top is a must have basic for every woman Made from soft caress cambric this sleeveless top features a scoop neckline with collar and side vents at the hem The flattering and easy silhouette makes it great for any body type and the full coverage style makes this piece an essential for your wardrobe ", "availability": 1, "productMRP": 899.0, "productSite": "http://www.styleever.com", "productCategory": "women", "image_paths": "[\"full/7305235ebe9c0413e8117eae2e72681a867c9be7.jpg\", \"full/a000d5b7a2cc3e90533532c4ad4343a304e51b91.jpg\", \"full/4370b40ef6decf52cf6893e2ed11bb7ae376bcc3.jpg\", \"full/a0a7763b1b9667be4d6a62500da8cb0ab74dafa6.jpg\"]", "productSubCategory": "tops"}},{"_index":"scraped_data","_type":"products","_id":"Tu9kmjiCTiG8C5R6qX23qA","_score":1.0, "_source" : {"productTitle": "Amante Long Leg Side Stripe Swimsuit", "productPrice": 573.0, "hasVariants": 1, "currency": "INR", "productURL": "http://www.zivame.com/swimwear/amante-long-leg-side-stripe-swimsuit.html", "productDesc": "Flatter and support your body with this long leg swimsuit from Amante This style has shelf support padded bra in built and is made from durable chlorine resistant fabric to retain its shape Broad stripe along the side of the swimsuit gives contour to your figure Composition 80 Nylon 20 Elasthane", "availability": 1, "productMRP": 1145.0, "productSite": "http://www.zivame.com", "productCategory": "women", "image_paths": "[\"full/a1b844df630ac4d354207ea9b13a8fe57c497958.jpg\", \"full/f809af416c540f9e22c0528a58fe25574809c135.jpg\", \"full/24402e2c502b9b08c5cb3730007a84366c30e78d.jpg\", \"full/3d4d2667dd623ee855229b6e219e2967d2837883.jpg\", \"full/61095cc872206b8ce1bf1dff192ec0d34db5c7d8.jpg\", \"full/572cb8cfd759085b1d14a17ee260d58a4e3acb3f.jpg\", \"full/b28adc3711b155abad4b163eb0eb1fdd45d29499.jpg\", \"full/7528715b36c6e391fe82148486b899f35085919d.jpg\", \"full/6f40c67fda7dfdb0742125a35b8ef436596755d3.jpg\", \"full/092dc82f9975f509e604cf39a4bdc81a37819539.jpg\"]", "productSubCategory": "swimwear"}},{"_index":"scraped_data","_type":"products","_id":"o40F5eLhSfmvyJibQ_hX7g","_score":1.0, "_source" : {"productTitle": "Cotton Saree Code 179218", "productPrice": 0.0, "hasVariants": 0, "currency": "INR", "productURL": "http://www.adachikan.net/index.php/women/cotton-sarees/cotton-saree-code-179218.html", "productDesc": "", "availability": 1, "productMRP": 1775.0, "productSite": "http://www.adachikan.net/", "productCategory": "women", "image_paths": "[\"full/502a513273e9149fd43efca9a3a4355790809d1a.jpg\", \"full/646071e3646a529272a9494f7c86c37abf75c7b4.jpg\", \"full/2ceb3abf5102e01faef2157e5901b48399e70c98.jpg\", \"full/cb0db89158241204ca27ecc72e4737e32236e096.jpg\"]", "productSubCategory": "sarees"}}]}}
Can someone please tell me what is happening ....
Source: (StackOverflow)
I am using Elastic Search python. I am search a string like "Arvind Kejriwal India Today Economic Times" and it gives me reasonable results. I was hoping I could increase weight of the first words more in the search query. How can I do that?
res = es.search(index="article-index", fields="url", body={"query": {"query_string": {"query": keywordstr, "fields": ["text", "title", "tags", "domain"]}}})
I am using the above command to search right now.
Source: (StackOverflow)