Greetings to all
I need your help please
I'm testing with the following project:
curl -X DELETE localhost:9200/geonames
curl -X PUT "http://localhost:9200/geonames" -d '
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"autocomplete": {
"tokenizer": "whitespace",
"filter": [
"lowercase",
"engram"
]
}
},
"filter": {
"engram": {
"type": "edgeNGram",
"min_gram": 1,
"max_gram": 10
}
}
}
}
},
"mappings": {
"geoname": {
"properties": {
"asciiname": {
"type": "multi_field",
"fields": {
"asciiname": {
"type": "string",
"index": "not_analyzed",
"store": "yes"
},
"autocomplete": {
"type": "string",
"index_analyzer": "autocomplete",
"index": "analyzed",
"search_analyzer": "standard"
}
}
},
"location" : { "type" : "geo_point", "store":"yes",
"index":"analyzed" }
}
}
}
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/1555414" -d '
{
"asciiname": "Santa Fe",
"location" : "29.01048, -101.26557"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/1818178" -d '
{
"asciiname": "Wardlow",
"location" : "32.55064, -115.33943"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/1818179" -d '
{
"asciiname": "Los Carapilas",
"location" : "32.01389, -115.01611"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/1818180" -d '
{
"asciiname": "Aguaje del Laretto",
"location" : "32.53306, -115.75139"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/1948754" -d '
{
"asciiname": "Canada El Oro",
"location" : "30.8973, -110.75184"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/2593121" -d '
{
"asciiname": "Paso Salinas",
"location" : "18.90224, -95.94041"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/3411918" -d '
{
"asciiname": "Chun Cedro",
"location" : "20.1542, -89.78498"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/3482868" -d '
{
"asciiname": "Tres Marias",
"location" : "22.48036, -98.01065"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/3482869" -d '
{
"asciiname": "Lorenzo del Real",
"location" : "22.51667, -97.91667"
}
'
curl -X PUT "http://localhost:9200/geonames/geoname/3482870" -d '
{
"asciiname": "El Estero",
"location" : "22.65685, -98.00748"
}
'
My query is as follows:
curl -XGET "localhost:9200/geonames/geoname/_search?pretty=true" -d '
{
"size": 0,
"fields" : [ "asciiname","location"],
"query": {
"term": {
"asciiname.autocomplete": "pa"
}
},
"facets": {
"asciiname": {
"terms": {
"field": "asciiname"
}
}
}
}
'
And it works fine, returns: asciiname
But I need to return the fields:
"asciiname" and "location"
the book says:
With the use of the fields array in the request body, ElasticSearch allows
us to
define which fields should be included in the response.
You can only return fields that are marked as stored in the mappings used
to create the
index.
Someone can tell me I'm missing or I'm doing wrong
Thanks for your attention
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.