Full text search?


(timrobertson100) #1

Hey,
I am building several thematic indexes onto the same content, but
would like to also do a full text version.

So I might do in the marine index:

$ curl -XPUT 'http://localhost:9200/specimens/marine/1' -d '
{
"scientificName" : "Gadus morhua",
"collectedDate" : "2009-11-15T14:12:12",
"commonName" : "Atlantic cod"
}
'

Can I simply do many2one along the lines of:

$ curl -XPUT 'http://localhost:9200/specimens/fullText/1' -d '
{
"terms" : {"Gadus morhua","2009-11-15T14:12:12","Atlantic cod"} //
possibly even breaking into "Gadus" and "morhua"
}
'

Or is there a better way? I didn't spot anything like this scanning the docs.
The reason I want to do this is because I want specific UI for various
themes (which will overlap but each will be a subset of the whole),
but still want to offer full text simple search capabilities over the
whole store (e.g. google style)

Thanks,
Tim


(Clinton Gormley) #2

Hiya

I am building several thematic indexes onto the same content, but
would like to also do a full text version.

Or is there a better way? I didn't spot anything like this scanning the docs.
The reason I want to do this is because I want specific UI for various
themes (which will overlap but each will be a subset of the whole),
but still want to offer full text simple search capabilities over the
whole store (e.g. google style)

Yes, this is easy to do.

ElasticSearch stores all documents as /$index/$type/$id so you could
have, eg

  • a single index for your whole application
  • multiple types, eg 'marine'

Each type can have it's own type definition, or 'mapping'
http://www.elasticsearch.com/docs/elasticsearch/mapping/

When you search, you can search in a particular index, for a particular
type. Or multiple types (or all types) in multiple indices (or all
indices):
http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/#Multiple_Indices_and_Types


$ curl -XPUT 'http://localhost:9200/specimens/fullText/1' -d '
{
"terms" : {"Gadus morhua","2009-11-15T14:12:12","Atlantic cod"} //
possibly even breaking into "Gadus" and "morhua"
}
'

So you don't need to store anything extra - with the data you're storing
already, it'll be sufficient. Just make sure that (eg) your scientific
name is 'analyzed', which will allow you to search for "Gadus" and
"morhua" separately.

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.


(Shay Banon) #3

Note also that master (0.6.0) will come with "_all" support which means you
can easily search on all fields. Here is the issue:
http://github.com/elasticsearch/elasticsearch/issues/closed#issue/63

http://github.com/elasticsearch/elasticsearch/issues/closed#issue/63
-shay.banon

On Sat, Mar 27, 2010 at 3:22 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hiya

I am building several thematic indexes onto the same content, but
would like to also do a full text version.

Or is there a better way? I didn't spot anything like this scanning the
docs.
The reason I want to do this is because I want specific UI for various
themes (which will overlap but each will be a subset of the whole),
but still want to offer full text simple search capabilities over the
whole store (e.g. google style)

Yes, this is easy to do.

ElasticSearch stores all documents as /$index/$type/$id so you could
have, eg

  • a single index for your whole application
  • multiple types, eg 'marine'

Each type can have it's own type definition, or 'mapping'
http://www.elasticsearch.com/docs/elasticsearch/mapping/

When you search, you can search in a particular index, for a particular
type. Or multiple types (or all types) in multiple indices (or all
indices):

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/#Multiple_Indices_and_Types

$ curl -XPUT 'http://localhost:9200/specimens/fullText/1' -d '
{
"terms" : {"Gadus morhua","2009-11-15T14:12:12","Atlantic cod"} //
possibly even breaking into "Gadus" and "morhua"
}
'

So you don't need to store anything extra - with the data you're storing
already, it'll be sufficient. Just make sure that (eg) your scientific
name is 'analyzed', which will allow you to search for "Gadus" and
"morhua" separately.

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.


(timrobertson100) #4

Do I define index mappings in a JSON file?
http://www.elasticsearch.com/docs/elasticsearch/mapping/
Or do I post them to ES?

Thanks,
Tim

On Sat, Mar 27, 2010 at 3:10 PM, Shay Banon
shay.banon@elasticsearch.com wrote:

Note also that master (0.6.0) will come with "_all" support which means you
can easily search on all fields. Here is the
issue: http://github.com/elasticsearch/elasticsearch/issues/closed#issue/63
-shay.banon

On Sat, Mar 27, 2010 at 3:22 PM, Clinton Gormley clinton@iannounce.co.uk
wrote:

Hiya

I am building several thematic indexes onto the same content, but
would like to also do a full text version.

Or is there a better way? I didn't spot anything like this scanning the
docs.
The reason I want to do this is because I want specific UI for various
themes (which will overlap but each will be a subset of the whole),
but still want to offer full text simple search capabilities over the
whole store (e.g. google style)

Yes, this is easy to do.

ElasticSearch stores all documents as /$index/$type/$id so you could
have, eg

  • a single index for your whole application
  • multiple types, eg 'marine'

Each type can have it's own type definition, or 'mapping'
http://www.elasticsearch.com/docs/elasticsearch/mapping/

When you search, you can search in a particular index, for a particular
type. Or multiple types (or all types) in multiple indices (or all
indices):

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/#Multiple_Indices_and_Types

$ curl -XPUT 'http://localhost:9200/specimens/fullText/1' -d '
{
"terms" : {"Gadus morhua","2009-11-15T14:12:12","Atlantic cod"} //
possibly even breaking into "Gadus" and "morhua"
}
'

So you don't need to store anything extra - with the data you're storing
already, it'll be sufficient. Just make sure that (eg) your scientific
name is 'analyzed', which will allow you to search for "Gadus" and
"morhua" separately.

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.


(Shay Banon) #5

You use the put_mapping API in order to post mappings to elasticsearch:
http://www.elasticsearch.com/docs/elasticsearch/rest_api/admin/indices/put_mapping/.
Note, you can always just post a json document and mappings will be
automatically created for it with default settings.

-shay.banon

On Sun, Mar 28, 2010 at 7:31 PM, Tim Robertson timrobertson100@gmail.comwrote:

Do I define index mappings in a JSON file?
http://www.elasticsearch.com/docs/elasticsearch/mapping/
Or do I post them to ES?

Thanks,
Tim

On Sat, Mar 27, 2010 at 3:10 PM, Shay Banon
shay.banon@elasticsearch.com wrote:

Note also that master (0.6.0) will come with "_all" support which means
you
can easily search on all fields. Here is the
issue:
http://github.com/elasticsearch/elasticsearch/issues/closed#issue/63
-shay.banon

On Sat, Mar 27, 2010 at 3:22 PM, Clinton Gormley <
clinton@iannounce.co.uk>
wrote:

Hiya

I am building several thematic indexes onto the same content, but
would like to also do a full text version.

Or is there a better way? I didn't spot anything like this scanning
the

docs.
The reason I want to do this is because I want specific UI for various
themes (which will overlap but each will be a subset of the whole),
but still want to offer full text simple search capabilities over the
whole store (e.g. google style)

Yes, this is easy to do.

ElasticSearch stores all documents as /$index/$type/$id so you could
have, eg

  • a single index for your whole application
  • multiple types, eg 'marine'

Each type can have it's own type definition, or 'mapping'
http://www.elasticsearch.com/docs/elasticsearch/mapping/

When you search, you can search in a particular index, for a particular
type. Or multiple types (or all types) in multiple indices (or all
indices):

http://www.elasticsearch.com/docs/elasticsearch/rest_api/search/#Multiple_Indices_and_Types

$ curl -XPUT 'http://localhost:9200/specimens/fullText/1' -d '
{
"terms" : {"Gadus morhua","2009-11-15T14:12:12","Atlantic cod"} //
possibly even breaking into "Gadus" and "morhua"
}
'

So you don't need to store anything extra - with the data you're storing
already, it'll be sufficient. Just make sure that (eg) your scientific
name is 'analyzed', which will allow you to search for "Gadus" and
"morhua" separately.

Clint

--
Web Announcements Limited is a company registered in England and Wales,
with company number 05608868, with registered address at 10 Arvon Road,
London, N5 1PR.


(system) #6