SearchContextMissingException - No search context found for id

2015-08-27 Thread CC
 

Hi,


I am using ES version 1.6.0 and the Python plugin for ES. I have a large 
collection of documents inside my index and I want to iterate through each 
and every document inside the index. In this sense I am using scan to get 
each document and retrieve the sentences it contains. I have written my 
function using an iterator to yield back each and every sentence. My code 
is this:


es1 = Elasticsearch(["http://localhost:9200";], timeout=30)

class Sentences(object):

def __init__(self, index, query):

self.index = index

self.query = query

def __iter__(self):

for doc in scan(es1, query=self.query, index=self.index):

doc_sentences = doc["_source"]["doc_sentences"]

for sentence in doc_sentences:

yield sentence


The iterator appers to be running initially, but after a while I get the 
error: "SearchContextMissingException - No search context found for id" 
followed by a list of document ids. I tried to increase the ES timeout, but 
didn't help. What can I do to overcome this? I am running out of ideas.


Thanks,

Cristina



-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/ebc92ec9-085c-4fdf-b874-49c80827edd0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Where does ElasticSearch store an index by default?

2015-06-18 Thread CC


I am currently indexing a large volume of data into ElasticSearch and I am 
not entirely sure where ES is actually storing the indices. My worries are 
that the indices are growing too large and might take up the entire space I 
have available on disk. In this sense, I would like to move them elsewhere 
(by creating snapshots and restoring them).

In the configuration it is specified that the actual location of the 
indices is /path/to/data (commented line), but inside my data folder I 
simply cannot find them. Also, is it possible to leave ES in the current 
location and point it to store indices in a different place?

Thanks,
Cristina

-- 
Please update your bookmarks! We have moved to https://discuss.elastic.co/
--- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/6bb1ec59-1bde-4393-a196-d1b33ff99c91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ElasticSearch - significant term aggregation with range

2014-10-27 Thread CC


I am interested to know how can I add a range for a significant terms 
aggregations query. For example:

{
  "query": {
 "terms": {
 "text_content": [
 "searchTerm"
  ]
 },
"range": {
  "dateField": {
"from": "date1",
"to": "date2"
}
  }
},
"aggregations": {
"significantQTypes": {
 "significant_terms": {
 "field": "field1",
 "size": 10
  }
}
 },
 "size": 0
}

will not work. Any suggestions on how to specify the range?

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/50f0ba07-9f76-4472-9bbd-15d774cc63f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Update similarity measure for existing index

2014-10-09 Thread CC


I have an existing index for which the default ElasticSearch similarity is 
used for all fields. I would like to update this index and set some other 
type of similarity, like BM25. The query I tried is:

curl -XPOST 'http://localhost:9200/myindex/' -d 
'{"settings":{"similarity":{"newSimilarity":{"type":"BM25"'

However, this crashes with an IndexAlreadyExists exception. Still, is it 
possible to update the similarity measure for all fields inside this index 
without having to reindex the data?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/d6463b4f-129b-41de-8fbc-bbc446887b54%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


List all terms of a significant term aggregation

2014-10-04 Thread CC


I am running the following ES query

curl -X GET 'http://localhost:9200/imoveis/_search?pretty' -d 
  '{"query":{"terms":{"field1":["searchterm"]}}, 

"aggregations":{"significantQTypes":{"significant_terms":{"field":"field1"}}}, 
"size":0}'

and, instead of listing only the top 10 buckets, I would like to list 100 
buckets or all of them. Still I am not sure how this is possible, any 
suggestions? Thanks a lot!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/0cd5a5d4-8f80-4a5b-a0ff-f24ce916a07b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Elastic Search - Query multiple indices

2014-05-15 Thread CC
Hi! I have data stored in 3 indices that I want to query, but these indices 
have different fields. If I try it like this:

curl -X GET 'http://host:9200/myindex1,myindex2,myindex3/_search?pretty' -d 
'{"query":{"bool":{"must":[{"query_string":{"query":"myquery","default_operator":"AND"}},
 
{"range":{"due_date":{"from":"2011-11-30T19:09:06.275Z","to":"2013-07-07T02:52:37.012Z"}}}]}},
 
"facets":{"facet1":{"terms":{"field":"text_content", "size":100' 

the results returned by ElasticSearch refer only to the first index, namely 
myindex1. Another issue is that I really need to filter these results by 
due_date, but only myIndex1 contains this field. The text_content field can 
also vary per index, i.e that in myindex2 and myindex3 it has got a 
different name.

How can I achieve my purpose using ElasticSearch? Many thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/e911d3e5-1213-46bb-8ca2-04b411b04abf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Elastic Search - display all distinct values of an array

2014-04-14 Thread CC


For a field mapped as string I have stored list of strings in the ES index, 
for ex:

  subject: ["Scientific Research", "Numerical Analysis", "History of Art"]

I would like to query this field and retrieve the full names of categories 
with their frequency count. What I tried so far with facets:

  "query":{
   "match_all": {}
   }, 
   "facets":{
   "tag":{
   "terms":{
   "field":"subject"}
 }
   }  

is not working as expected because it splits my subject fields into tokens 
and returns me the top most frequent stopwords. How can I get full entries 
ordered by counts for an analyzed field, and not only the top 10, if 
possible? Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/b85c18f5-ef9b-46c3-b210-30b68094a477%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Statistical facet on length of string field

2014-04-13 Thread CC
Thank you very much for your reply. I tried using script fields, like this: 

  "query":{
 "match_all": {}
 }, 
 "script_fields":{
"test1":{
   "script": "_source.title.length()"}
   }
}

 but what I get back from ES are only counts for the top 10 docs. How can I 
get values like max length, min length and average length for my title 
field? Thank you!

On Saturday, April 12, 2014 2:50:04 PM UTC+2, vineeth mohan wrote:
>
> Hello Cristina , 
>
> This is not possible using stat facet. It expect the field to be a number 
> and it calculates max/min etc based on its different values.
>
> A way to do this would be to add a new field while indexing which would be 
> the length of the title.
> Then performing stats over it might work.
>
> There might be other solutions based on scripting , but i need to explore 
> ...
>
> Thanks
>Vineeth
>
>
> On Sat, Apr 12, 2014 at 3:25 PM, Cristina Garbacea 
> 
> > wrote:
>
>> I would like to retrieve statistical data about a string field like the 
>> min, max and average length (by counting the number of characters inside 
>> the string). I am using CURL to do this and I have what I have tried so far 
>>
>>"query":{
>>  "match_all": {}
>> }, 
>>"facets":{
>>  "stats":{
>>"statistical":{
>>  "field":"title"}
>>  }
>> }
>>
>> returns me exception because the facet expects a number field. How can I 
>> achieve my goal? Thanks!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elasticsearc...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/3c1a08f2-e467-47c3-a667-43837ac9b352%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8bd3444c-5095-463c-adb9-60ea2eb42e57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Statistical facet on length of string field

2014-04-12 Thread CC
Oh, I found out! I was supposed to use length(). Thanks a lot, you pointed 
me in the right direction! :)

On Saturday, April 12, 2014 4:15:59 PM UTC+2, CC wrote:
>
>   Thank you very much for your reply. I tried using script fields, like 
> this: 
>
>   "query":{
>  "match_all": {}
>  }, 
>  "script_fields":{
> "test1":{
>"script": "_source.title.length"}
>}
> }
>
> but my issue now is that I get "PropertyAccessException: Could not access 
> length". My title field is of type string and I was expecting ElasticSearch 
> to know about it. I am also using CURL for queries, is there any way to 
> overcome this error?
>
> Thank you,
> Cristina
>
> On Saturday, April 12, 2014 2:50:04 PM UTC+2, vineeth mohan wrote:
>>
>> Hello Cristina , 
>>
>> This is not possible using stat facet. It expect the field to be a number 
>> and it calculates max/min etc based on its different values.
>>
>> A way to do this would be to add a new field while indexing which would 
>> be the length of the title.
>> Then performing stats over it might work.
>>
>> There might be other solutions based on scripting , but i need to explore 
>> ...
>>
>> Thanks
>>Vineeth
>>
>>
>> On Sat, Apr 12, 2014 at 3:25 PM, Cristina Garbacea > > wrote:
>>
>>> I would like to retrieve statistical data about a string field like the 
>>> min, max and average length (by counting the number of characters inside 
>>> the string). I am using CURL to do this and I have what I have tried so far 
>>>
>>>"query":{
>>>  "match_all": {}
>>> }, 
>>>"facets":{
>>>  "stats":{
>>>"statistical":{
>>>  "field":"title"}
>>>  }
>>> }
>>>
>>> returns me exception because the facet expects a number field. How can I 
>>> achieve my goal? Thanks!
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "elasticsearch" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to elasticsearc...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/elasticsearch/3c1a08f2-e467-47c3-a667-43837ac9b352%40googlegroups.com<https://groups.google.com/d/msgid/elasticsearch/3c1a08f2-e467-47c3-a667-43837ac9b352%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8fbb42c1-636b-41f6-b22d-4e4bbaf21719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Statistical facet on length of string field

2014-04-12 Thread CC
  Thank you very much for your reply. I tried using script fields, like 
this: 

  "query":{
 "match_all": {}
 }, 
 "script_fields":{
"test1":{
   "script": "_source.title.length"}
   }
}

but my issue now is that I get "PropertyAccessException: Could not access 
length". My title field is of type string and I was expecting ElasticSearch 
to know about it. I am also using CURL for queries, is there any way to 
overcome this error?

Thank you,
Cristina

On Saturday, April 12, 2014 2:50:04 PM UTC+2, vineeth mohan wrote:
>
> Hello Cristina , 
>
> This is not possible using stat facet. It expect the field to be a number 
> and it calculates max/min etc based on its different values.
>
> A way to do this would be to add a new field while indexing which would be 
> the length of the title.
> Then performing stats over it might work.
>
> There might be other solutions based on scripting , but i need to explore 
> ...
>
> Thanks
>Vineeth
>
>
> On Sat, Apr 12, 2014 at 3:25 PM, Cristina Garbacea 
> 
> > wrote:
>
>> I would like to retrieve statistical data about a string field like the 
>> min, max and average length (by counting the number of characters inside 
>> the string). I am using CURL to do this and I have what I have tried so far 
>>
>>"query":{
>>  "match_all": {}
>> }, 
>>"facets":{
>>  "stats":{
>>"statistical":{
>>  "field":"title"}
>>  }
>> }
>>
>> returns me exception because the facet expects a number field. How can I 
>> achieve my goal? Thanks!
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "elasticsearch" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to elasticsearc...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/elasticsearch/3c1a08f2-e467-47c3-a667-43837ac9b352%40googlegroups.com
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8245a839-4374-4235-a942-0a531c79cdfa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.